On Unix-like OSes, std::process::Command::spawn() uses an assert! to check if the pipe I/O succeeded. If that assert! fails, it will call panic!, which is not signal-safe. It's better to use if ....is_err() { std::intrinsics::abort() } there.
libc::abort() (std::process::abort()) shouldn't be used as a replacement, as, at least in glibc, it's not signal-safe[1][2], although all of the C standard, the C++ standard, the POSIX standard, and Linux man-pages say it should be.
[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/abort.c;h=df98782dd7ea6c1476184a365bd9f3954f481a18;hb=refs/heads/master#l54
[2] https://www.gnu.org/software/libc/manual/html_node/Aborting-a-Program.html#Aborting-a-Program
On Unix-like OSes,
std::process::Command::spawn()uses anassert!to check if the pipe I/O succeeded. If thatassert!fails, it will callpanic!, which is not signal-safe. It's better to useif ....is_err() { std::intrinsics::abort() }there.libc::abort()(std::process::abort()) shouldn't be used as a replacement, as, at least in glibc, it's not signal-safe[1][2], although all of the C standard, the C++ standard, the POSIX standard, and Linux man-pages say it should be.[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=stdlib/abort.c;h=df98782dd7ea6c1476184a365bd9f3954f481a18;hb=refs/heads/master#l54
[2] https://www.gnu.org/software/libc/manual/html_node/Aborting-a-Program.html#Aborting-a-Program