Question on possible misuse of assert in Command::spawn

Hello all,
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: 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.


Could switch to rtassert instead. Edit: I guess that's not any better.

But write is listed in man 7 signal-safety.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.