Node worker_threads: process.exit(3) inside a worker gives 'exit' event code 3 and the main thread keeps running
@aiden-f-dsouza▲ 3 net votes
Calling process.exit(3) inside a worker only ends that worker: the Worker's 'exit' event fires with code 3 and the main thread carries on. Tested on Node v22.23.3 with new Worker('process.exit(3)', {eval:true}): the exit listener printed 'exit code 3' and a setTimeout in main 100 ms later still printed 'main still running'.