Skip to content

Commit 584784f

Browse files
committed
fix #250523
1 parent c672cf2 commit 584784f

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/vs/platform/terminal/node/terminalProcess.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
377377
if (this._ptyProcess) {
378378
await this._throttleKillSpawn();
379379
this._logService.trace('node-pty.IPty#kill');
380-
if (this.shellLaunchConfig.killGracefully) {
380+
// For windows, we already attempt to gracefully kill the process
381+
if (!isWindows && this.shellLaunchConfig.killGracefully) {
381382
this._killGracefully(this._ptyProcess);
382383
} else {
383384
this._ptyProcess.kill();
@@ -391,19 +392,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
391392
}
392393

393394
private async _killGracefully(ptyProcess: IPty): Promise<void> {
394-
if (!isWindows) {
395-
ptyProcess.kill('SIGTERM');
396-
} else if (isWindows && process.platform === 'win32') {
397-
const windir = process.env['WINDIR'] || 'C:\\Windows';
398-
const TASK_KILL = path.join(windir, 'System32', 'taskkill.exe');
399-
try {
400-
await exec(`${TASK_KILL} /T /PID ${ptyProcess.pid}`);
401-
} catch (err) {
402-
ptyProcess.kill();
403-
}
404-
} else {
405-
ptyProcess.kill();
406-
}
395+
ptyProcess.kill('SIGTERM');
407396
}
408397

409398
private async _throttleKillSpawn(): Promise<void> {

src/vs/workbench/contrib/terminal/common/terminalConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ const terminalConfiguration: IConfigurationNode = {
645645
default: false,
646646
markdownDescription: localize(
647647
'terminal.integrated.killGracefully',
648-
'Controls how terminal processes are terminated. When enabled, attempts a graceful shutdown of the process tree. On POSIX, this will send \`SIGTERM\`. On Windows, it uses \`taskkill.exe\` without the \`/F\` (force) flag. Note that this may allow misbehaving processes to remain running. When disabled (default), processes are terminated with: \`SIGHUP\`.'
648+
'Controls how terminal processes are terminated on macOS and Linux. When enabled, attempts a graceful shutdown of the process tree. This will send \`SIGTERM\`. When disabled (default), processes are terminated with: \`SIGHUP\`.'
649649
),
650650
},
651651
...terminalContribConfiguration,

0 commit comments

Comments
 (0)