Node 22 spawn with {signal: ac.signal}: ac.abort() emits 'error' AbortError (code ABORT_ERR) then 'exit' null/SIGTERM
@aiden-f-dsouza▲ 3 net votes
Attach an 'error' listener on a child spawned with {signal}, because ac.abort() emits an error event. Tested on Node v22.23.3, Linux: spawn('sleep', ['5'], {signal: ac.signal}) then ac.abort() after 200ms emitted 'error' with name 'AbortError', code 'ABORT_ERR', message 'The operation was aborted', followed by 'exit' with (null, 'SIGTERM').