forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#67219 - jsgf:command-argv0-debug, r=joshtri…
…plett Fix up Command Debug output when arg0 is specified. PR rust-lang#66512 added the ability to set argv[0] on Command. As a side effect, it changed the Debug output to print both the program and argv[0], which in practice results in stuttery output (`"echo" "echo" "foo"`). This PR reverts the behaviour to the the old one, so that the command is only printed once - unless arg0 has been set. In that case it emits `"[command]" "arg0" "arg1" ...`.
- Loading branch information
Showing
6 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// run-pass | ||
|
||
// ignore-windows - this is a unix-specific test | ||
// ignore-cloudabi no processes | ||
// ignore-emscripten no processes | ||
// ignore-sgx no processes | ||
#![feature(process_set_argv0)] | ||
|
||
use std::os::unix::process::CommandExt; | ||
use std::process::Command; | ||
|
||
fn main() { | ||
let mut command = Command::new("some-boring-name"); | ||
|
||
assert_eq!(format!("{:?}", command), r#""some-boring-name""#); | ||
|
||
command.args(&["1", "2", "3"]); | ||
|
||
assert_eq!(format!("{:?}", command), r#""some-boring-name" "1" "2" "3""#); | ||
|
||
command.arg0("exciting-name"); | ||
|
||
assert_eq!(format!("{:?}", command), r#"["some-boring-name"] "exciting-name" "1" "2" "3""#); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.