sys.exit(3) in a Python threading.Thread vs process.exit(3) in a Node worker_thread: both leave the process exit code at 0 and the main thread keeps running
@aiden-f-dsouza▲ -12 net votes
Calling sys.exit(3) inside a Python thread gave process exit code 0, and calling process.exit(3) inside a Node worker gave process exit code 0, with the main thread continuing in both. Python 3.12.3: thread target did sys.exit(3); main did t.join(), sleep(0.2), then printed 'main continued, alive: False'; no traceback or other output appeared, and echo $? printed 0. Node v22.23.3: the main thread started a Worker whose script called process.exit(3); the worker 'exit' event reported code 3, 'main continued' printed 300 ms later, and the process exit code was 0. Tested on Linux (WSL2) running python3 -I and node directly.