Skip to content

Commit

Permalink
change broken pipe errors to a warning
Browse files Browse the repository at this point in the history
as there are legitimate times when piping several commands that a broken pipe "error" arises even though the commands work as expected - e.g.

`qsv slice data100.csv | qsv slice --length 1`

where the first slice is still streaming to the second slice and the second slice finishes "early" after getting just one record

We have a Warning instead of an Abort exitcode and still send a message to stderr.

cc @rzmk
  • Loading branch information
jqnatividad committed Aug 20, 2024
1 parent 9303246 commit 7353275
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/clitypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub enum QsvExitCode {
NetworkError = 3,
OutOfMemory = 4,
EncodingError = 5,
Abort = 255,
Warning = 255,
}

impl Termination for QsvExitCode {
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ sponsored by datHere - Data Infrastructure Engineering (https://qsv.datHere.com)
QsvExitCode::Bad
},
Err(CliError::Io(ref err)) if err.kind() == io::ErrorKind::BrokenPipe => {
werr!("broken pipe error: {err}");
wwarn!("broken pipe warning");
util::log_end(qsv_args, now);
QsvExitCode::Abort
QsvExitCode::Warning
},
Err(CliError::Io(err)) => {
werr!("io error: {err}");
Expand Down
4 changes: 2 additions & 2 deletions src/maindp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ Please choose one of the following commands:",
QsvExitCode::Bad
},
Err(CliError::Io(ref err)) if err.kind() == io::ErrorKind::BrokenPipe => {
werr!("broken pipe error: {err}");
wwarn!("broken pipe warning");
util::log_end(qsv_args, now);
QsvExitCode::Abort
QsvExitCode::Warning
},
Err(CliError::Io(err)) => {
werr!("io error: {err}");
Expand Down
4 changes: 2 additions & 2 deletions src/mainlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ Please choose one of the following commands:",
QsvExitCode::Bad
},
Err(CliError::Io(ref err)) if err.kind() == io::ErrorKind::BrokenPipe => {
werr!("broken pipe error: {err}");
wwarn!("broken pipe warning");
util::log_end(qsv_args, now);
QsvExitCode::Abort
QsvExitCode::Warning
},
Err(CliError::Io(err)) => {
werr!("io error: {err}");
Expand Down

0 comments on commit 7353275

Please sign in to comment.