about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2024-07-26 09:17:07 +0200
committerJakub Beránek <berykubik@gmail.com>2024-07-26 09:17:34 +0200
commitabd8768768cf47829b8f9826e69d083657e8b8fd (patch)
tree21ccdb109749b6f0261ab15ae829334cbcb0ab29
parent603c0afc999bf5be5b310e49f39e3d2dcdf98cac (diff)
Fix storing of stdout/stderr in bootstrap commands that failed to start
Before, their stdout/stderr was forcefully set to `None`, even if the corresponding command tried to capture output.
-rw-r--r--src/bootstrap/src/lib.rs2
-rw-r--r--src/bootstrap/src/utils/exec.rs14
2 files changed, 13 insertions, 3 deletions
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 899a80fa9c7..1bcae250c3f 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1005,7 +1005,7 @@ Executed at: {executed_at}"#,
             \nIt was not possible to execute the command: {e:?}"
                 )
                 .unwrap();
-                CommandOutput::did_not_start()
+                CommandOutput::did_not_start(stdout, stderr)
             }
         };
         if !output.is_success() {
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 3b04459db06..627ea050043 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -231,8 +231,18 @@ pub struct CommandOutput {
 
 impl CommandOutput {
     #[must_use]
-    pub fn did_not_start() -> Self {
-        Self { status: CommandStatus::DidNotStart, stdout: None, stderr: None }
+    pub fn did_not_start(stdout: OutputMode, stderr: OutputMode) -> Self {
+        Self {
+            status: CommandStatus::DidNotStart,
+            stdout: match stdout {
+                OutputMode::Print => None,
+                OutputMode::Capture => Some(vec![]),
+            },
+            stderr: match stderr {
+                OutputMode::Print => None,
+                OutputMode::Capture => Some(vec![]),
+            },
+        }
     }
 
     #[must_use]