mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)
* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 * disable strict null check
This commit is contained in:
37
extensions/vscode-test-resolver/src/util/processes.ts
Normal file
37
extensions/vscode-test-resolver/src/util/processes.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as cp from 'child_process';
|
||||
import * as path from 'path';
|
||||
|
||||
export interface TerminateResponse {
|
||||
success: boolean;
|
||||
error?: any;
|
||||
}
|
||||
|
||||
export function terminateProcess(p: cp.ChildProcess, extensionPath: string): TerminateResponse {
|
||||
if (process.platform === 'win32') {
|
||||
try {
|
||||
const options: any = {
|
||||
stdio: ['pipe', 'pipe', 'ignore']
|
||||
};
|
||||
cp.execFileSync('taskkill', ['/T', '/F', '/PID', p.pid.toString()], options);
|
||||
} catch (err) {
|
||||
return { success: false, error: err };
|
||||
}
|
||||
} else if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||
try {
|
||||
const cmd = path.join(extensionPath, 'scripts', 'terminateProcess.sh');
|
||||
const result = cp.spawnSync(cmd, [process.pid.toString()]);
|
||||
if (result.error) {
|
||||
return { success: false, error: result.error };
|
||||
}
|
||||
} catch (err) {
|
||||
return { success: false, error: err };
|
||||
}
|
||||
} else {
|
||||
p.kill('SIGKILL');
|
||||
}
|
||||
return { success: true };
|
||||
}
|
||||
Reference in New Issue
Block a user