diff options
| author | topecongiro <seuchida@gmail.com> | 2017-10-26 06:03:07 +0900 |
|---|---|---|
| committer | topecongiro <seuchida@gmail.com> | 2017-10-27 09:26:53 +0900 |
| commit | 732d9b281cbcc88a627fddb660a3b4021e1d94cf (patch) | |
| tree | d9beb93314bb62681c4471ee68b090de4b80a4b1 | |
| parent | 2f5ae25a34077aad82a5dc41c2684cd21279df58 (diff) | |
| download | rust-732d9b281cbcc88a627fddb660a3b4021e1d94cf.tar.gz rust-732d9b281cbcc88a627fddb660a3b4021e1d94cf.zip | |
Return 0 when ./x.py has no subcommand
| -rw-r--r-- | src/bootstrap/flags.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index df378188b4a..b5d51598fab 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -136,9 +136,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"); let subcommand = match subcommand { Some(s) => s, None => { - // No subcommand -- show the general usage and subcommand help + // No or an invalid subcommand -- show the general usage and subcommand help + // An exit code will be 0 when no subcommand is given, and 1 in case of an invalid + // subcommand. println!("{}\n", subcommand_help); - process::exit(1); + let exit_code = if args.is_empty() { 0 } else { 1 }; + process::exit(exit_code); } }; |
