Skip to content

Commit abd8768

Browse files
committed
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.
1 parent 603c0af commit abd8768

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/bootstrap/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ Executed at: {executed_at}"#,
10051005
\nIt was not possible to execute the command: {e:?}"
10061006
)
10071007
.unwrap();
1008-
CommandOutput::did_not_start()
1008+
CommandOutput::did_not_start(stdout, stderr)
10091009
}
10101010
};
10111011
if !output.is_success() {

src/bootstrap/src/utils/exec.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,18 @@ pub struct CommandOutput {
231231

232232
impl CommandOutput {
233233
#[must_use]
234-
pub fn did_not_start() -> Self {
235-
Self { status: CommandStatus::DidNotStart, stdout: None, stderr: None }
234+
pub fn did_not_start(stdout: OutputMode, stderr: OutputMode) -> Self {
235+
Self {
236+
status: CommandStatus::DidNotStart,
237+
stdout: match stdout {
238+
OutputMode::Print => None,
239+
OutputMode::Capture => Some(vec![]),
240+
},
241+
stderr: match stderr {
242+
OutputMode::Print => None,
243+
OutputMode::Capture => Some(vec![]),
244+
},
245+
}
236246
}
237247

238248
#[must_use]

0 commit comments

Comments
 (0)