I was reading the implementation of Command::spawn for unix, and I have a doubt.
I think that the assert call there on line 70 is not safe.
According to assert: https://doc.rust-lang.org/src/core/macros/mod.rs.html#1283-1287 it will internally call panic! macro which in turn will in the end, call write.
Between fork and exec, only async-signal-safe functions are allowed. For this reason, with that assert, the panicked process might be locked forever (because it should call _write to print to stderr). This rely on the possibility of that assert failing which I think this is fine because the output.write it's very unlikely to fail, but still this is might happen.