From 60efd18c23eec4338f8d3ba7e093027be6c26323 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 16 Jun 2020 17:11:08 +0200 Subject: [PATCH] Task logging for failure cases And unneded condition clean up --- src/vs/workbench/api/common/extHostTask.ts | 28 +++++++++---------- .../tasks/browser/terminalTaskSystem.ts | 4 ++- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/api/common/extHostTask.ts b/src/vs/workbench/api/common/extHostTask.ts index 154cf069bcf..271ee362aaf 100644 --- a/src/vs/workbench/api/common/extHostTask.ts +++ b/src/vs/workbench/api/common/extHostTask.ts @@ -512,12 +512,10 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape { public async $onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): Promise { const execution = await this.getTaskExecution(value.id); - if (execution) { - this._onDidTaskProcessStarted.fire({ - execution: execution, - processId: value.processId - }); - } + this._onDidTaskProcessStarted.fire({ + execution: execution, + processId: value.processId + }); } public get onDidEndTaskProcess(): Event { @@ -526,12 +524,10 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape { public async $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): Promise { const execution = await this.getTaskExecution(value.id); - if (execution) { - this._onDidTaskProcessEnded.fire({ - execution: execution, - exitCode: value.exitCode - }); - } + this._onDidTaskProcessEnded.fire({ + execution: execution, + exitCode: value.exitCode + }); } protected abstract provideTasksInternal(validTypes: { [key: string]: boolean; }, taskIdPromises: Promise[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[], extension: IExtensionDescription }; @@ -643,9 +639,11 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape { }); this._taskExecutionPromises.set(execution.id, createdResult); - return createdResult.then(result => { - this._taskExecutions.set(execution.id, result); - return result; + return createdResult.then(executionCreatedResult => { + this._taskExecutions.set(execution.id, executionCreatedResult); + return executionCreatedResult; + }, rejected => { + return Promise.reject(rejected); }); } diff --git a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts index 4c9521dc7f1..c6a26ba532c 100644 --- a/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts +++ b/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts @@ -46,6 +46,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IPathService } from 'vs/workbench/services/path/common/pathService'; import { env as processEnv, cwd as processCwd } from 'vs/base/common/process'; import { IViewsService, IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views'; +import { ILogService } from 'vs/platform/log/common/log'; interface TerminalData { terminal: ITerminalInstance; @@ -202,6 +203,7 @@ export class TerminalTaskSystem implements ITaskSystem { private terminalInstanceService: ITerminalInstanceService, private pathService: IPathService, private viewDescriptorService: IViewDescriptorService, + private logService: ILogService, taskSystemInfoResolver: TaskSystemInfoResolver, ) { @@ -722,7 +724,7 @@ export class TerminalTaskSystem implements ITaskSystem { processStartedSignaled = true; } }, (_error) => { - // The process never got ready. Need to think how to handle this. + this.logService.error('Task terminal process never got ready'); }); this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.Start, task, terminal.id)); let skipLine: boolean = (!!task.command.presentation && task.command.presentation.echo);