cargo panics when stdin to it is closed #6723
Labels
A-console-output
Area: Terminal output, colors, progress bar, etc.
A-jobserver
Area: jobserver, concurrency, parallelism
C-bug
Category: bug
Problem
When
exec
ing e.g.cargo build
with a closedstdin
file descriptor, it panics with:Expected behavior:
cargo
should treat this the same as ifstdin
was a valid file descriptor that nothing gets written to.Steps
This can be reproduced e.g. by a rust program that:
libc::close(libc::STDIN_FILENO)
,nix::unistd::execvp
to runcargo build
on a project.Here's an example repo including a
reproduce.sh
script to show the bug: https://github.com/soenkehahn/entr-cargo-bugPossible Solution(s)
I think
cargo
could check withfcntl(libc::STDIN_FILENO, libc::F_GETFD)
whetherstdin
is still open.Notes
This is motivated by trying to use
cargo
in conjunction withentr
. Since this commit it closes thestdin
of the called command when using the-r
(restart) option.Output of
cargo version
:cargo 1.33.0 (f099fe94b 2019-02-12)
On linux.
The text was updated successfully, but these errors were encountered: