Skip to content

process: throw on execve(2) failure instead of aborting - #62878

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
bengl:bengl/execve-throws
Apr 27, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
bengl:bengl/execve-throws

Conversation

@bengl

@bengl bengl commented Apr 21, 2026

Copy link
Copy Markdown
Member

When the underlying execve(2) system call fails, process.execve() previously printed an error to stderr and called ABORT(), preventing JS code from detecting or recovering from common failures such as a missing binary. Throw an ErrnoException instead, carrying the usual code, errno, syscall, and path properties.

To leave the process in a clean state when execve(2) fails, no longer run native AtExit callbacks before the call (their in-memory effects are discarded on success anyway), and snapshot and restore the FD_CLOEXEC flags on stdio so a failed call has no observable side effects. Rename and update test-process-execve-abort.js accordingly and document the new behaviour.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Apr 21, 2026
@codecov

codecov Bot commented Apr 21, 2026 •