File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,15 +168,22 @@ export const createPool = async ({
168168 > ;
169169 close : ( ) => Promise < void > ;
170170} > => {
171- // Some options may crash worker, e.g. --prof, --title.
171+ // Propagate parent execArgv to workers, except flags known to cause issues
172+ // in child processes (--prof writes per-worker profiling logs, --title is
173+ // meaningless for workers). Safe for child_process.fork; the referenced
174+ // Node.js issue (#41103) only affects worker_threads.
172175 // https://github.com/nodejs/node/issues/41103
173- const execArgv = process . execArgv . filter (
174- ( execArg ) =>
175- execArg . startsWith ( '--perf' ) ||
176- execArg . startsWith ( '--cpu-prof' ) ||
177- execArg . startsWith ( '--heap-prof' ) ||
178- execArg . startsWith ( '--diagnostic-dir' ) ,
179- ) ;
176+ const blockedFlags = [ '--prof' , '--title' ] ;
177+ const execArgv = process . execArgv . filter ( ( arg , i , arr ) => {
178+ if ( blockedFlags . some ( ( f ) => arg === f || arg . startsWith ( `${ f } =` ) ) ) {
179+ return false ;
180+ }
181+ // skip standalone value following --title (handles `--title foo` form)
182+ if ( i > 0 && arr [ i - 1 ] === '--title' ) {
183+ return false ;
184+ }
185+ return true ;
186+ } ) ;
180187
181188 const numCpus = getNumCpus ( ) ;
182189
You can’t perform that action at this time.
0 commit comments