Dump tar stdout/err on failure for better debug (#6024) (#6027)

automerge
This commit is contained in:
mergify[bot]
2019-09-23 13:57:39 -07:00
committed by Grimes
parent d180eedd17
commit 7c5557d69b

View File

@ -122,12 +122,16 @@ impl SnapshotPackagerService {
args.push(TAR_ACCOUNTS_DIR); args.push(TAR_ACCOUNTS_DIR);
args.push(TAR_SNAPSHOTS_DIR); args.push(TAR_SNAPSHOTS_DIR);
let status = std::process::Command::new("tar").args(&args).status()?; let output = std::process::Command::new("tar").args(&args).output()?;
if !output.status.success() {
warn!("tar command failed with exit code: {}", output.status);
use std::str::from_utf8;
info!("tar stdout: {}", from_utf8(&output.stdout).unwrap_or("?"));
info!("tar stderr: {}", from_utf8(&output.stderr).unwrap_or("?"));
if !status.success() {
return Err(Self::get_io_error(&format!( return Err(Self::get_io_error(&format!(
"Error trying to generate snapshot archive: {}", "Error trying to generate snapshot archive: {}",
status output.status
))); )));
} }