Skip to content

Commit

Permalink
schema: Print an error if the qsv stats invocation fails
Browse files Browse the repository at this point in the history
Aborts if either
* the stats process is killed (e.g. SIGKIL due to memory pressure)
* or the stats process returns a non-zero return code
  • Loading branch information
abrauchli committed Sep 6, 2024
1 parent 5241e39 commit eeff961
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,23 @@ pub fn get_stats_records(
let qsv_bin = std::env::current_exe().unwrap();
let mut stats_cmd = std::process::Command::new(qsv_bin);
stats_cmd.args(stats_args_vec);
let _stats_output = stats_cmd.output()?;
let status = stats_cmd.output()?.status;
let status_code = status.code();
if status_code.is_none() {
if let Some(signal) = status.signal() {

Check failure

Code scanning / clippy

no method named signal found for struct std::process::ExitStatus in the current scope Error

no method named signal found for struct std::process::ExitStatus in the current scope
return Err(CliError::Other(
format!("qsv stats terminated with signal: {}", signal).to_string(),
));
} else {
return Err(CliError::Other(
"qsv stats terminated by unknown cause".to_string(),
));
}
} else if let Some(code) = status_code {
return Err(CliError::Other(
format!("qsv stats exited with code: {}", code).to_string(),
));
}

// create a statsdatajon from the output of the stats command
csv_to_jsonl(
Expand Down

0 comments on commit eeff961

Please sign in to comment.