Skip to content

Commit 010ae22

Browse files
committed
Remove tree-kill
After many tests on different operation systems it seems that tree-kill works well on windows but not on mac. So using the standard way to kill the process in node for mac/linux and exec taskkill command for windows.
1 parent 76a5294 commit 010ae22

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"dependencies": {
2828
"node-ipc": "8.10.3",
2929
"source-map": "0.6.1",
30-
"tree-kill": "^1.2.0",
3130
"universal-analytics": "0.4.13",
3231
"vscode-chrome-debug-core": "~3.9.0",
3332
"vscode-debugadapter": "1.26.0",

src/common/utilities.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as fs from 'fs';
1010
import * as url from 'url';
1111
import * as path from 'path';
1212
import {Version} from './version';
13+
import {ChildProcess, exec} from 'child_process';
1314

1415
export const enum Platform {
1516
Windows, OSX, Linux
@@ -380,4 +381,16 @@ export function getInstalledExtensionVersion(): Version {
380381

381382
export function getMinSupportedCliVersion(): Version {
382383
return Version.parse(require('../../package.json').minNativescriptCliVersion);
384+
}
385+
386+
export function killProcess(childProcess: ChildProcess) : void {
387+
switch (process.platform) {
388+
case "win32":
389+
exec(`taskkill /pid ${childProcess.pid} /T /F`);
390+
break;
391+
392+
default:
393+
childProcess.kill("SIGINT");
394+
break;
395+
}
383396
}

src/debug-adapter/webKitDebugAdapter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {formatConsoleMessage} from './consoleHelper';
1616
import {Services} from '../services/debugAdapterServices';
1717
import {LoggerHandler, Handlers, Tags} from '../common/logger';
1818
import {DebugRequest} from './debugRequest';
19-
import * as kill from 'tree-kill';
2019

2120
interface IScopeVarHandle {
2221
objectId: string;
@@ -358,7 +357,7 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
358357
public disconnect(): Promise<void> {
359358
this.clearEverything();
360359
if (this._tnsProcess) {
361-
kill(this._tnsProcess.pid, 'SIGQUIT')
360+
utils.killProcess(this._tnsProcess);
362361
this._tnsProcess = null;
363362
}
364363
if (this._webKitConnection) {

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {Services} from './services/extensionHostServices';
44
import {Project} from './project/project';
55
import {IosProject} from './project/iosProject';
66
import {AndroidProject} from './project/androidProject';
7-
import * as kill from 'tree-kill';
7+
import * as utils from './common/utilities';
88

99
// this method is called when the extension is activated
1010
export function activate(context: vscode.ExtensionContext) {
@@ -57,7 +57,7 @@ export function activate(context: vscode.ExtensionContext) {
5757
});
5858

5959
context.subscriptions.push({
60-
dispose: () => kill(tnsProcess.pid, "SIGQUIT")
60+
dispose: () => utils.killProcess(tnsProcess)
6161
});
6262
};
6363

0 commit comments

Comments
 (0)