Skip to content

Commit

Permalink
fix comments from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
rschnekenbu committed Jul 20, 2023
1 parent acbba01 commit 3e60edd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions packages/task/src/browser/task-terminal-widget-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class TaskTerminalWidgetManager {
if (terminal.taskId === finishedTaskId) {
const showReuseMessage = !!event.config && TaskOutputPresentation.shouldShowReuseMessage(event.config);
const closeOnFinish = !!event.config && TaskOutputPresentation.shouldCloseTerminalOnFinish(event.config);
this.notifyTaskFinished(terminal, showReuseMessage, closeOnFinish);
this.updateTerminalOnTaskExit(terminal, showReuseMessage, closeOnFinish);
break;
}
}
Expand All @@ -114,11 +114,11 @@ export class TaskTerminalWidgetManager {
terminal.taskConfig = taskConfig;
terminal.busy = true;
} else {
this.notifyTaskFinished(terminal, true, false);
this.updateTerminalOnTaskExit(terminal, true, false);
}
});
const didConnectFailureListener = terminal.onDidOpenFailure(async () => {
this.notifyTaskFinished(terminal, true, false);
this.updateTerminalOnTaskExit(terminal, true, false);
});
terminal.onDidDispose(() => {
didConnectListener.dispose();
Expand Down Expand Up @@ -212,14 +212,13 @@ export class TaskTerminalWidgetManager {
return this.terminalService.all.filter(TaskTerminalWidget.is);
}

protected notifyTaskFinished(terminal: TaskTerminalWidget, showReuseMessage: boolean, closeOnFinish: boolean): void {
protected updateTerminalOnTaskExit(terminal: TaskTerminalWidget, showReuseMessage: boolean, closeOnFinish: boolean): void {
terminal.busy = false;
terminal.scrollToBottom();
if (showReuseMessage) {
terminal.writeLine('\x1b[1m\n\rTerminal will be reused by tasks. \x1b[0m\n');
}
if (closeOnFinish) {
terminal.close();
} else if (showReuseMessage) {
terminal.scrollToBottom();
terminal.writeLine('\x1b[1m\n\rTerminal will be reused by tasks. \x1b[0m\n');
}
}
}
2 changes: 1 addition & 1 deletion packages/task/src/common/task-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export namespace TaskOutputPresentation {
}

export function shouldCloseTerminalOnFinish(task: TaskCustomization): boolean {
return !task.presentation || task.presentation.close === undefined || !!task.presentation.close;
return !!task.presentation && !!task.presentation.close;
}

export function shouldShowReuseMessage(task: TaskCustomization): boolean {
Expand Down

0 comments on commit 3e60edd

Please sign in to comment.