diff --git a/package.json b/package.json index d6ea62381..3eb9c1650 100644 --- a/package.json +++ b/package.json @@ -1726,7 +1726,6 @@ "node-fetch": "^2.6.1", "popper.js": "^1.16.1", "showdown": "^1.9.1", - "tree-kill": "^1.2.2", "vscode-languageclient": "^7.0.0", "vsls": "^1.0.4753", "winreg": "^1.2.4", diff --git a/src/util.ts b/src/util.ts index 638365ee7..4b5546139 100644 --- a/src/util.ts +++ b/src/util.ts @@ -8,7 +8,6 @@ import * as vscode from 'vscode'; import * as cp from 'child_process'; import { rGuestService, isGuestSession } from './liveShare'; import { extensionContext } from './extension'; -import * as kill from 'tree-kill'; export function config(): vscode.WorkspaceConfiguration { return vscode.workspace.getConfiguration('r'); @@ -412,16 +411,19 @@ export function asDisposable(toDispose: T, disposeFunction: (...args: unknown export type DisposableProcess = cp.ChildProcessWithoutNullStreams & vscode.Disposable; export function exec(command: string, args?: ReadonlyArray, options?: cp.CommonOptions, onDisposed?: () => unknown): DisposableProcess { const proc = cp.spawn(command, args, options); + console.log(`Process ${proc.pid} spawned`); let running = true; const exitHandler = () => { running = false; + console.log(`Process ${proc.pid} exited`); }; proc.on('exit', exitHandler); proc.on('error', exitHandler); const disposable = asDisposable(proc, () => { if (running) { + console.log(`Process ${proc.pid} terminating`); if (process.platform === 'win32') { - kill(proc.pid); + cp.spawnSync('taskkill', ['/pid', proc.pid.toString(), '/f', '/t']); } else { proc.kill('SIGKILL'); } diff --git a/yarn.lock b/yarn.lock index 8e9baca73..84bc1965b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2597,11 +2597,6 @@ to-regex-range@^5.0.1: resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9" integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk= -tree-kill@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" - integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== - ts-loader@^9.2.3: version "9.2.3" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.2.3.tgz#dc3b6362a4d4382493cd4f138d345f419656de68"