Skip to content

Commit 189f41e

Browse files
fix: vars
1 parent 9dbf3ca commit 189f41e

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

test/commands/lightning/dev/helpers/processUtils.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
*/
1616

1717
import { type ChildProcess } from 'node:child_process';
18-
import treeKill from 'tree-kill';
1918

2019
/**
2120
* Clean up a server process and all its child processes. Uses tree-kill so
2221
* descendant node processes (e.g. LWR workers) are terminated.
2322
*/
24-
export function killServerProcess(serverProcess: ChildProcess | null | undefined): void {
25-
if (!serverProcess?.pid) return;
26-
const pid = serverProcess.pid;
23+
export function killServerProcess(serverProcess: ChildProcess | undefined): void {
24+
// Clean up
2725
try {
28-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
29-
treeKill(pid, 'SIGKILL');
26+
if (serverProcess?.pid && process.kill(serverProcess.pid, 0)) {
27+
process.kill(serverProcess.pid, 'SIGKILL');
28+
}
3029
} catch (error) {
3130
const err = error as NodeJS.ErrnoException;
3231
if (err.code !== 'ESRCH') throw error;

0 commit comments

Comments
 (0)