From d2c12204e0785df9ea0d6c100a7dcb94f17492bc Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 7 May 2024 17:09:17 +0200 Subject: [PATCH] Inherit stderr of to subprocesses for debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default `Command::output()` causes *both* stdout and stderr to be redirected to separate pipe. If following code does not print stderr this can cause error to be swallowed, making debugging harder. This changes to inherit stderr instead, so error messages go to Rover’s own stderr. --- src/command/supergraph/compose/do_compose.rs | 1 + tests/installers.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/command/supergraph/compose/do_compose.rs b/src/command/supergraph/compose/do_compose.rs index f5f491a0d..7c5325e93 100644 --- a/src/command/supergraph/compose/do_compose.rs +++ b/src/command/supergraph/compose/do_compose.rs @@ -148,6 +148,7 @@ impl Compose { let output = Command::new(&exe) .args(["compose", yaml_path.as_ref()]) + .stderr(std::process::Stdio::inherit()) .output() .context("Failed to execute command")?; let stdout = str::from_utf8(&output.stdout) diff --git a/tests/installers.rs b/tests/installers.rs index 8bbeef283..d6de68fe5 100644 --- a/tests/installers.rs +++ b/tests/installers.rs @@ -30,6 +30,7 @@ fn it_has_windows_installer() { fn get_binstall_scripts_root() -> Utf8PathBuf { let cargo_locate_project_output = Command::new("cargo") .arg("locate-project") + .stderr(std::process::Stdio::inherit()) .output() .expect("Could not run `cargo locate-project`");