Skip to content

Commit 60efd18

Browse files
committed
Task logging for failure cases
And unneded condition clean up
1 parent 388da4e commit 60efd18

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/vs/workbench/api/common/extHostTask.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,10 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
512512

513513
public async $onDidStartTaskProcess(value: tasks.TaskProcessStartedDTO): Promise<void> {
514514
const execution = await this.getTaskExecution(value.id);
515-
if (execution) {
516-
this._onDidTaskProcessStarted.fire({
517-
execution: execution,
518-
processId: value.processId
519-
});
520-
}
515+
this._onDidTaskProcessStarted.fire({
516+
execution: execution,
517+
processId: value.processId
518+
});
521519
}
522520

523521
public get onDidEndTaskProcess(): Event<vscode.TaskProcessEndEvent> {
@@ -526,12 +524,10 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
526524

527525
public async $onDidEndTaskProcess(value: tasks.TaskProcessEndedDTO): Promise<void> {
528526
const execution = await this.getTaskExecution(value.id);
529-
if (execution) {
530-
this._onDidTaskProcessEnded.fire({
531-
execution: execution,
532-
exitCode: value.exitCode
533-
});
534-
}
527+
this._onDidTaskProcessEnded.fire({
528+
execution: execution,
529+
exitCode: value.exitCode
530+
});
535531
}
536532

537533
protected abstract provideTasksInternal(validTypes: { [key: string]: boolean; }, taskIdPromises: Promise<void>[], handler: HandlerData, value: vscode.Task[] | null | undefined): { tasks: tasks.TaskDTO[], extension: IExtensionDescription };
@@ -643,9 +639,11 @@ export abstract class ExtHostTaskBase implements ExtHostTaskShape {
643639
});
644640

645641
this._taskExecutionPromises.set(execution.id, createdResult);
646-
return createdResult.then(result => {
647-
this._taskExecutions.set(execution.id, result);
648-
return result;
642+
return createdResult.then(executionCreatedResult => {
643+
this._taskExecutions.set(execution.id, executionCreatedResult);
644+
return executionCreatedResult;
645+
}, rejected => {
646+
return Promise.reject(rejected);
649647
});
650648
}
651649

src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
4646
import { IPathService } from 'vs/workbench/services/path/common/pathService';
4747
import { env as processEnv, cwd as processCwd } from 'vs/base/common/process';
4848
import { IViewsService, IViewDescriptorService, ViewContainerLocation } from 'vs/workbench/common/views';
49+
import { ILogService } from 'vs/platform/log/common/log';
4950

5051
interface TerminalData {
5152
terminal: ITerminalInstance;
@@ -202,6 +203,7 @@ export class TerminalTaskSystem implements ITaskSystem {
202203
private terminalInstanceService: ITerminalInstanceService,
203204
private pathService: IPathService,
204205
private viewDescriptorService: IViewDescriptorService,
206+
private logService: ILogService,
205207
taskSystemInfoResolver: TaskSystemInfoResolver,
206208
) {
207209

@@ -722,7 +724,7 @@ export class TerminalTaskSystem implements ITaskSystem {
722724
processStartedSignaled = true;
723725
}
724726
}, (_error) => {
725-
// The process never got ready. Need to think how to handle this.
727+
this.logService.error('Task terminal process never got ready');
726728
});
727729
this._onDidStateChange.fire(TaskEvent.create(TaskEventKind.Start, task, terminal.id));
728730
let skipLine: boolean = (!!task.command.presentation && task.command.presentation.echo);

0 commit comments

Comments
 (0)