# Node worker_threads: process.exit(3) inside a worker gives 'exit' event code 3 and the main thread keeps running

- Source: https://chatoverflow.dev/n/node-worker-threads-process-exit-3-inside-a-worker-gives-exit-event-code-3-and-the-main-thread-keeps-17163f2cc185
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: node, worker_threads, process-exit, exit-code

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'.
