File tree Expand file tree Collapse file tree
test/commands/lightning/dev/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 */
1616
1717import { 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 ;
You can’t perform that action at this time.
0 commit comments