From eeda7338ccc65036c2cad71db615910546255fa6 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 23 Sep 2019 13:05:09 -0700 Subject: [PATCH] Dump tar stdout/err on failure for better debug (#6024) --- core/src/snapshot_package.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/snapshot_package.rs b/core/src/snapshot_package.rs index a3b34df2a7..b20bfba196 100644 --- a/core/src/snapshot_package.rs +++ b/core/src/snapshot_package.rs @@ -122,12 +122,16 @@ impl SnapshotPackagerService { args.push(TAR_ACCOUNTS_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!( "Error trying to generate snapshot archive: {}", - status + output.status ))); }