Skip to content

Commit 8e5cfc6

Browse files
committed
Review changes
1 parent 7a0fa5a commit 8e5cfc6

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/bootstrap/src/utils/exec.rs

+13-14
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ pub enum OutputMode {
3434
/// If you want to allow failures, use [allow_failure].
3535
/// If you want to delay failures until the end of bootstrap, use [delay_failure].
3636
///
37-
/// By default, the command will print its stdout/stderr to stdout/stderr of bootstrap
38-
/// ([OutputMode::Print]).
37+
/// By default, the command will print its stdout/stderr to stdout/stderr of bootstrap ([OutputMode::Print]).
3938
/// If you want to handle the output programmatically, use [BootstrapCommand::capture].
4039
///
4140
/// Bootstrap will print a debug log to stdout if the command fails and failure is not allowed.
@@ -144,8 +143,8 @@ impl From<Command> for BootstrapCommand {
144143
}
145144
}
146145

147-
/// Represents the outcome of starting a command.
148-
enum CommandOutcome {
146+
/// Represents the current status of `BootstrapCommand`.
147+
enum CommandStatus {
149148
/// The command has started and finished with some status.
150149
Finished(ExitStatus),
151150
/// It was not even possible to start the command.
@@ -155,20 +154,20 @@ enum CommandOutcome {
155154
/// Represents the output of an executed process.
156155
#[allow(unused)]
157156
pub struct CommandOutput {
158-
outcome: CommandOutcome,
157+
status: CommandStatus,
159158
stdout: Vec<u8>,
160159
stderr: Vec<u8>,
161160
}
162161

163162
impl CommandOutput {
164163
pub fn did_not_start() -> Self {
165-
Self { outcome: CommandOutcome::DidNotStart, stdout: vec![], stderr: vec![] }
164+
Self { status: CommandStatus::DidNotStart, stdout: vec![], stderr: vec![] }
166165
}
167166

168167
pub fn is_success(&self) -> bool {
169-
match self.outcome {
170-
CommandOutcome::Finished(status) => status.success(),
171-
CommandOutcome::DidNotStart => false,
168+
match self.status {
169+
CommandStatus::Finished(status) => status.success(),
170+
CommandStatus::DidNotStart => false,
172171
}
173172
}
174173

@@ -177,9 +176,9 @@ impl CommandOutput {
177176
}
178177

179178
pub fn status(&self) -> Option<ExitStatus> {
180-
match self.outcome {
181-
CommandOutcome::Finished(status) => Some(status),
182-
CommandOutcome::DidNotStart => None,
179+
match self.status {
180+
CommandStatus::Finished(status) => Some(status),
181+
CommandStatus::DidNotStart => None,
183182
}
184183
}
185184

@@ -199,7 +198,7 @@ impl CommandOutput {
199198
impl Default for CommandOutput {
200199
fn default() -> Self {
201200
Self {
202-
outcome: CommandOutcome::Finished(ExitStatus::default()),
201+
status: CommandStatus::Finished(ExitStatus::default()),
203202
stdout: vec![],
204203
stderr: vec![],
205204
}
@@ -209,7 +208,7 @@ impl Default for CommandOutput {
209208
impl From<Output> for CommandOutput {
210209
fn from(output: Output) -> Self {
211210
Self {
212-
outcome: CommandOutcome::Finished(output.status),
211+
status: CommandStatus::Finished(output.status),
213212
stdout: output.stdout,
214213
stderr: output.stderr,
215214
}

src/bootstrap/src/utils/helpers.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,13 @@ pub fn check_cfg_arg(name: &str, values: Option<&[&str]>) -> String {
494494
format!("--check-cfg=cfg({name}{next})")
495495
}
496496

497-
/// Prepares `Command` that runs git inside the source directory if given.
497+
/// Prepares `BootstrapCommand` that runs git inside the source directory if given.
498498
///
499499
/// Whenever a git invocation is needed, this function should be preferred over
500-
/// manually building a git `Command`. This approach allows us to manage bootstrap-specific
501-
/// needs/hacks from a single source, rather than applying them on next to every `Command::new("git")`,
502-
/// which is painful to ensure that the required change is applied on each one of them correctly.
500+
/// manually building a git `BootstrapCommand`. This approach allows us to manage
501+
/// bootstrap-specific needs/hacks from a single source, rather than applying them on next to every
502+
/// `BootstrapCommand::new("git")`, which is painful to ensure that the required change is applied
503+
/// on each one of them correctly.
503504
pub fn git(source_dir: Option<&Path>) -> BootstrapCommand {
504505
let mut git = BootstrapCommand::new("git");
505506

0 commit comments

Comments
 (0)