Skip to content

Commit 2839f78

Browse files
authored
Silently handle broken pipe on windows for yes (#10429)
BrokenPipe errors should be ignored only on Windows. For unix platforms supporting SIGPIPE, receiving a BrokenPipe error means that the default SIGPIPE handler was disabled, and requires returning an error code.
1 parent e96ddc0 commit 2839f78

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/uu/yes/src/yes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
2727

2828
match exec(&buffer) {
2929
Ok(()) => Ok(()),
30+
// On Windows, silently handle broken pipe since there's no SIGPIPE
31+
#[cfg(windows)]
3032
Err(err) if err.kind() == io::ErrorKind::BrokenPipe => Ok(()),
3133
Err(err) => Err(USimpleError::new(
3234
1,

0 commit comments

Comments
 (0)