child_process: clear timeout timer on spawn-time error too · nodejs/node@146f00f · GitHub
Skip to content

Commit 146f00f

Browse files
kishore280aduh95
authored andcommitted
child_process: clear timeout timer on spawn-time error too
When spawn() fails at the OS level (ENOENT, EACCES, EAGAIN, EMFILE, ENFILE), the resulting ChildProcess only ever emits 'error', never 'exit'. The `timeout` option's cleanup only listened for 'exit', so the timer stayed armed for the full `timeout` duration on any spawn-time failure, holding the event loop open well after the promise/callback had already settled via 'error'. Clear the timer on 'error' as well as 'exit'. Fixes: #65504 Signed-off-by: kishore280 <maheshwarankishore@gmail.com> PR-URL: #65506 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent a27db42 commit 146f00f

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎lib/child_process.js‎

Lines changed: 2 additions & 1 deletion
Lines changed: 19 additions & 0 deletions

0 commit comments

Comments
 (0)