Fix backgound task terminals not closing

Fixes #126586
This commit is contained in:
Alex Ross 2021-06-17 16:13:40 +02:00
parent a414bf2973
commit d9418aa01e
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840

View file

@ -1169,19 +1169,23 @@ export class TerminalTaskSystem extends Disposable implements ITaskSystem {
let options = await this.resolveOptions(resolver, task.command.options);
const presentationOptions = task.command.presentation;
let waitOnExit: boolean | string = (presentationOptions?.close !== undefined) ? !presentationOptions.close : true;
let waitOnExit: boolean | string = false;
if (!presentationOptions) {
throw new Error('Task presentation options should not be undefined here.');
}
if ((presentationOptions.close === undefined) && ((presentationOptions.reveal !== RevealKind.Never) || !task.configurationProperties.isBackground)) {
if (presentationOptions.panel === PanelKind.New) {
waitOnExit = nls.localize('closeTerminal', 'Press any key to close the terminal.');
} else if (presentationOptions.showReuseMessage) {
waitOnExit = nls.localize('reuseTerminal', 'Terminal will be reused by tasks, press any key to close it.');
} else {
waitOnExit = true;
if ((presentationOptions.close === undefined) || (presentationOptions.close === false)) {
if ((presentationOptions.reveal !== RevealKind.Never) || !task.configurationProperties.isBackground) {
if (presentationOptions.panel === PanelKind.New) {
waitOnExit = nls.localize('closeTerminal', 'Press any key to close the terminal.');
} else if (presentationOptions.showReuseMessage) {
waitOnExit = nls.localize('reuseTerminal', 'Terminal will be reused by tasks, press any key to close it.');
} else {
waitOnExit = true;
}
}
} else {
waitOnExit = !presentationOptions.close;
}
let commandExecutable: string | undefined;