From c171ee4b122190c3da40adb9310e56548bb10aae Mon Sep 17 00:00:00 2001 From: Kun Ren Date: Mon, 13 Dec 2021 22:50:24 +0800 Subject: [PATCH 1/2] Use cp.kill --- src/helpViewer/helpProvider.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/helpViewer/helpProvider.ts b/src/helpViewer/helpProvider.ts index b02968e55..1dee6d9b1 100644 --- a/src/helpViewer/helpProvider.ts +++ b/src/helpViewer/helpProvider.ts @@ -2,7 +2,6 @@ import { Memento, window } from 'vscode'; import * as http from 'http'; import * as cp from 'child_process'; -import * as kill from 'tree-kill'; import * as path from 'path'; import * as fs from 'fs'; import * as os from 'os'; @@ -39,8 +38,8 @@ export class HelpProvider { } public async refresh(): Promise { - if(this.cp.running){ - kill(this.cp.pid); // more reliable than cp.kill (?) + if (this.cp.running) { + this.cp.kill(); } this.cp = this.launchRHelpServer(); await this.cp.port; @@ -173,8 +172,8 @@ export class HelpProvider { dispose(): void { - if(this.cp.running){ - kill(this.cp.pid); + if (this.cp.running) { + this.cp.kill(); } } } From bad02f7c59b4130bac861b82c9059a10dc9df322 Mon Sep 17 00:00:00 2001 From: Kun Ren Date: Mon, 13 Dec 2021 23:49:30 +0800 Subject: [PATCH 2/2] Use tree-kill with SIGKILL --- src/helpViewer/helpProvider.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helpViewer/helpProvider.ts b/src/helpViewer/helpProvider.ts index 1dee6d9b1..5ca646085 100644 --- a/src/helpViewer/helpProvider.ts +++ b/src/helpViewer/helpProvider.ts @@ -2,6 +2,7 @@ import { Memento, window } from 'vscode'; import * as http from 'http'; import * as cp from 'child_process'; +import * as kill from 'tree-kill'; import * as path from 'path'; import * as fs from 'fs'; import * as os from 'os'; @@ -39,7 +40,8 @@ export class HelpProvider { public async refresh(): Promise { if (this.cp.running) { - this.cp.kill(); + // this.cp.kill('SIGKILL'); + kill(this.cp.pid, 'SIGKILL'); // more reliable than cp.kill (?) } this.cp = this.launchRHelpServer(); await this.cp.port; @@ -173,7 +175,8 @@ export class HelpProvider { dispose(): void { if (this.cp.running) { - this.cp.kill(); + // this.cp.kill('SIGKILL'); + kill(this.cp.pid, 'SIGKILL'); } } }