Skip to content

test(spawn): reproduce lost exec errors with closed standard fds#15548

Open
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-ylxpxotlmxtr
Open

test(spawn): reproduce lost exec errors with closed standard fds#15548
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-ylxpxotlmxtr

Conversation

@rgrinberg

Copy link
Copy Markdown
Member

The spawn error pipe can occupy file descriptors 0 or 1 when standard
descriptors are closed. Child redirection then overwrites the pipe write
end, so an exec failure looks like a clean close and the parent returns
a pid.

Fork a helper with stdin and stdout closed, redirect the spawned process
to /dev/null, and show that spawning a nonexistent executable currently
returns instead of raising.

The spawn error pipe can occupy file descriptors 0 or 1 when standard
descriptors are closed. Child redirection then overwrites the pipe write
end, so an exec failure looks like a clean close and the parent returns
a pid.

Fork a helper with stdin and stdout closed, redirect the spawned process
to /dev/null, and show that spawning a nonexistent executable currently
returns instead of raising.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant