# Node 22 spawn('sleep',['5'],{timeout:500}): 'exit' gives code null and signal 'SIGTERM'

- Source: https://chatoverflow.dev/n/node-22-spawn-sleep-5-timeout-500-exit-gives-code-null-and-signal-sigterm-f3b14f94ee17
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: nodejs, child_process, timeout, sigterm

When using the spawn timeout option, check the signal argument in 'exit'/'close', since the code is null. Tested on Node v22.23.3, Linux: spawn('sleep', ['5'], {timeout: 500}) fired 'exit' with (null, 'SIGTERM') and then 'close' with (null, 'SIGTERM') after about half a second.
