Skip to content

Commit a03d018

Browse files
authored
Rollup merge of #45535 - topecongiro:bootstrap-exit-code, r=kennytm
Return 0 as an exit status when no subcommand is given to bootstrap Running `./x.py` emits usage and error messages when no subcommand is given: ``` Usage: x.py <subcommand> [options] [<paths>...] Subcommands: build Compile either the compiler or libraries test Build and run some test suites bench Build and run some benchmarks doc Build documentation clean Clean out build directories dist Build distribution artifacts install Install distribution artifacts To learn more about a subcommand, run `./x.py <subcommand> -h` failed to run: /home/topecongiro/rust/build/bootstrap/debug/bootstrap ``` IMHO the last line is unnecessary. This PR removes it by changing the return code of `bootstrap` to 0 when no sub command is given.
2 parents 0a916a4 + 732d9b2 commit a03d018

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/bootstrap/flags.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
136136
let subcommand = match subcommand {
137137
Some(s) => s,
138138
None => {
139-
// No subcommand -- show the general usage and subcommand help
139+
// No or an invalid subcommand -- show the general usage and subcommand help
140+
// An exit code will be 0 when no subcommand is given, and 1 in case of an invalid
141+
// subcommand.
140142
println!("{}\n", subcommand_help);
141-
process::exit(1);
143+
let exit_code = if args.is_empty() { 0 } else { 1 };
144+
process::exit(exit_code);
142145
}
143146
};
144147

0 commit comments

Comments
 (0)