Skip to content

Commit ed3024f

Browse files
committed
src/utils: move killProcess to test
go-outline usage is removed. This function does not need to be included in the main extension code. Change-Id: I8ca3e7b3cfc29015a09c3cff78d7ade668945f55 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/538761 Commit-Queue: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Peter Weinberger <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent a829b31 commit ed3024f

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/utils/processUtils.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,3 @@ export function killProcessTree(p: ChildProcess, logger: (...args: any[]) => voi
2121
});
2222
});
2323
}
24-
25-
// Kill a process.
26-
//
27-
// READ THIS BEFORE USING THE FUNCTION:
28-
//
29-
// TODO: This function is kept for historical reasons and should be removed once
30-
// its user (go-outline) is replaced. Outlining uses this function and not
31-
// killProcessTree because of performance issues that were observed in the past.
32-
// See https://go-review.googlesource.com/c/vscode-go/+/242518/ for more
33-
// details and background.
34-
export function killProcess(p: ChildProcess) {
35-
if (p && p.pid && p.exitCode === null) {
36-
try {
37-
p.kill();
38-
} catch (e) {
39-
console.log(`Error killing process ${p.pid}: ${e}`);
40-
}
41-
}
42-
}

test/integration/goDebug.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
import * as extConfig from '../../src/config';
2929
import { GoDebugConfigurationProvider, parseDebugProgramArgSync } from '../../src/goDebugConfiguration';
3030
import { getBinPath, rmdirRecursive } from '../../src/util';
31-
import { killProcessTree, killProcess } from '../../src/utils/processUtils';
31+
import { killProcessTree } from '../../src/utils/processUtils';
3232
import getPort = require('get-port');
3333
import util = require('util');
3434
import { TimestampedLogger } from '../../src/goLogging';
@@ -2565,3 +2565,14 @@ function tryRmdirRecursive(dir: string) {
25652565
console.log(`failed to delete ${dir}: ${e}`);
25662566
}
25672567
}
2568+
2569+
// Kill a process.
2570+
function killProcess(p: cp.ChildProcess) {
2571+
if (p && p.pid && p.exitCode === null) {
2572+
try {
2573+
p.kill();
2574+
} catch (e) {
2575+
console.log(`Error killing process ${p.pid}: ${e}`);
2576+
}
2577+
}
2578+
}

0 commit comments

Comments
 (0)