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.
This commit is contained in:
Jakub Beránek 2024-07-26 09:17:07 +02:00
parent 603c0afc99
commit abd8768768
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
2 changed files with 13 additions and 3 deletions

View file

@ -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() {

View file

@ -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]