You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wc_preserves_native_failure_exit_code is racy, EPIPE when the child exits before the write #3739
thread 'wc_preserves_native_failure_exit_code' panicked at tests/pipeline_stdin_test.rs:18:10:
write stdin: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }
The test spawns wc --definitely-invalid-rtk-test-option, which prints usage and exits right away. If the process exits before the writer is able to write, it fires EPIPE. I measured 15 out of 2000 spawns on an idle 24 core box and 131 out of 2000 with every core busy, so it fails on build machines and stays hidden on idle CI.
Sleeping 50ms before the write makes it deterministic: 50 out of 50 for the invalid option, and 0 out of 50 for wc_reads_piped_stdin, which is unaffected because wc blocks on the read there.
Given that any command that actually reads stdin should have an assert that makes sure the output processed the given input, wc_reads_piped_stdin asserting "2" being the example, it seems safe to drop the error. In that case I propose the following pattern:
Activity