File tree Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Expand file tree Collapse file tree 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22import { spawn } from 'node:child_process' ;
33
4+ const SUPPORTS_PROCESS_GROUP_SIGNALS =
5+ process . platform !== 'win32' && process . platform !== 'cygwin' ;
6+
47const MANIFEST_WAIT_TARGETS = [
58 'tcp:3009' ,
69 'tcp:3012' ,
@@ -248,19 +251,31 @@ function sendSignal(proc, signal) {
248251 return ;
249252 }
250253
254+ if ( SUPPORTS_PROCESS_GROUP_SIGNALS ) {
255+ try {
256+ process . kill ( - proc . pid , signal ) ;
257+ return ;
258+ } catch ( error ) {
259+ if (
260+ error . code !== 'ESRCH' &&
261+ error . code !== 'EPERM' &&
262+ error . code !== 'ERR_INVALID_ARG_VALUE'
263+ ) {
264+ throw error ;
265+ }
266+ }
267+ }
268+
251269 try {
252- process . kill ( - proc . pid , signal ) ;
270+ proc . kill ( signal ) ;
253271 } catch ( error ) {
254- if ( error . code !== 'ESRCH' && error . code !== 'EPERM' ) {
272+ if (
273+ error . code !== 'ESRCH' &&
274+ error . code !== 'EPERM' &&
275+ error . code !== 'ERR_INVALID_ARG_VALUE'
276+ ) {
255277 throw error ;
256278 }
257- try {
258- proc . kill ( signal ) ;
259- } catch ( innerError ) {
260- if ( innerError . code !== 'ESRCH' ) {
261- throw innerError ;
262- }
263- }
264279 }
265280}
266281
You can’t perform that action at this time.
0 commit comments