fix(stdio): Ignore WouldBlock errors to match C behavior#154996
fix(stdio): Ignore WouldBlock errors to match C behavior#154996skyfireitdiy wants to merge 1 commit intorust-lang:mainfrom
Conversation
Modify the print_to function to silently ignore EAGAIN/WouldBlock errors instead of panicking. This ensures consistent behavior with C language in redirection scenarios (such as Docker containers) and avoids unexpected panics due to non-blocking I/O.
|
r? @jhpratt rustbot has assigned @jhpratt. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
So if you are redirecting to a nonblocking pipe or something we will now silently lose (parts) of the written data. That seems to me like it would lead to hard to debug problems as sometimes it works and sometimes it doesn't. And partial writes may completely break things when you are printing some machine readable format rather than a human readable format. If you really need this behavior, you can write your own replacement macros for |
Modify the print_to function to silently ignore EAGAIN/WouldBlock errors instead of panicking. This ensures consistent behavior with C language in redirection scenarios (such as Docker containers) and avoids unexpected panics due to non-blocking I/O.