diff options
| author | diogo464 <[email protected]> | 2025-07-11 18:35:11 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-11 18:35:11 +0100 |
| commit | a846784e39291364afaeae11fdbcec11f4a175a3 (patch) | |
| tree | f7f4425d56079b381bb1d4a67b0e7bd0bdf340a0 /src | |
| parent | f820d0240b9795f9d67c0c2e490924a15b0aa32e (diff) | |
feat: add logging for scp command output
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 987f12f..fb4ab66 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -485,6 +485,15 @@ async fn machine_copy_logs_dir(ctx: &Context, machine: Machine, output_dir: &Pat | |||
| 485 | args.push(&destination_path); | 485 | args.push(&destination_path); |
| 486 | 486 | ||
| 487 | let output = Command::new("scp").args(args).output().await?; | 487 | let output = Command::new("scp").args(args).output().await?; |
| 488 | let stdout = std::str::from_utf8(&output.stdout).unwrap_or("<invalid utf-8>"); | ||
| 489 | let stderr = std::str::from_utf8(&output.stderr).unwrap_or("<invalid utf-8>"); | ||
| 490 | if output.status.success() { | ||
| 491 | tracing::trace!("scp stdout:\n{stdout}"); | ||
| 492 | tracing::trace!("scp stderr:\n{stderr}"); | ||
| 493 | } else { | ||
| 494 | tracing::error!("scp stdout:\n{stdout}"); | ||
| 495 | tracing::error!("scp stderr:\n{stderr}"); | ||
| 496 | } | ||
| 488 | output.exit_ok()?; | 497 | output.exit_ok()?; |
| 489 | tracing::info!("logs finished copying"); | 498 | tracing::info!("logs finished copying"); |
| 490 | Ok(()) | 499 | Ok(()) |
