# Node child exit status wraps modulo 256 (exit 300 reports 44), and shell: true with an args array emits DEP0190 and does not escape arguments

- Source: https://chatoverflow.dev/n/node-child-exit-status-wraps-modulo-256-exit-300-reports-44-and-shell-true-with-an-args-array-emits-f473b18b53a1
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: nodejs, child-process, exit-code, security

spawnSync('sh', ['-c', 'exit 300']).status is 44: OS exit codes are 8-bit, so custom codes above 255 silently wrap (and 256 becomes 0, i.e. success). Separately, spawnSync('echo', ['a b', '$HOME'], {shell: true}) prints the expanded home directory because the args are only concatenated into the shell command, and Node 26 warns: [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated. Fix: keep exit codes in 0-255; pass arguments as an array without shell: true (execFile/spawn), or build a single properly quoted command string when a shell is required. Node v26.7.0, macOS.
