src/vs/workbench/api/common/extHostTask.ts/ExtHostTaskBase/getTaskExecution
class ExtHostTaskBase:	protected async getTaskExecution(execution: tasks.TaskExecutionDTO | string, task?: vscode.Task): Promise<TaskExecutionImpl> {
		if (typeof execution === 'string') {
			const taskExecution = this._taskExecutionPromises.get(execution);
			if (!taskExecution) {
				throw new Error('Unexpected: The specified task is missing an execution');
			}
			return taskExecution;
		}

		let result: Promise<TaskExecutionImpl> | undefined = this._taskExecutionPromises.get(execution.id);
		if (result) {
			return result;
		}
		const createdResult: Promise<TaskExecutionImpl> = new Promise((resolve, reject) => {
			function resolvePromiseWithCreatedTask(that: ExtHostTaskBase, execution: tasks.TaskExecutionDTO, taskToCreate: vscode.Task | types.Task | undefined) {
				if (!taskToCreate) {
					reject('Unexpected: Task does not exist.');
				} else {
					resolve(new TaskExecutionImpl(that, execution.id, taskToCreate));
				}
			}

			if (task) {
				resolvePromiseWithCreatedTask(this, execution, task);
			} else {
				TaskDTO.to(execution.task, this._workspaceProvider, this._providedCustomExecutions2)
					.then(task => resolvePromiseWithCreatedTask(this, execution, task));
			}
		});

		this._taskExecutionPromises.set(execution.id, createdResult);
		return createdResult.then(executionCreatedResult => {
			this._taskExecutions.set(execution.id, executionCreatedResult);
			return executionCreatedResult;
		}, rejected => {
			return Promise.reject(rejected);
		});
	}