src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts/AbstractTaskService/run
class AbstractTaskService:	public async run(task: Task | undefined, options?: ProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary | undefined> {
		if (!(await this.trust())) {
			return;
		}

		if (!task) {
			throw new TaskError(Severity.Info, nls.localize('TaskServer.noTask', 'Task to execute is undefined'), TaskErrors.TaskNotFound);
		}

		return new Promise<ITaskSummary | undefined>((resolve) => {
			let resolver = this.createResolver();
			if (options && options.attachProblemMatcher && this.shouldAttachProblemMatcher(task) && !InMemoryTask.is(task)) {
				this.attachProblemMatcher(task).then(toExecute => {
					if (toExecute) {
						resolve(this.executeTask(toExecute, resolver, runSource));
					} else {
						resolve(undefined);
					}
				});
			} else {
				resolve(this.executeTask(task, resolver, runSource));
			}
		}).then((value) => {
			if (runSource === TaskRunSource.User) {
				this.getWorkspaceTasks().then(workspaceTasks => {
					RunAutomaticTasks.promptForPermission(this, this.storageService, this.notificationService, this.workspaceTrustManagementService, this.openerService, workspaceTasks);
				});
			}
			return value;
		}, (error) => {
			this.handleError(error);
			return Promise.reject(error);
		});
	}