mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
run_external: remove inner quotes once nushell gets =
sign (#13073)
# Description Fixes: #13066 nushell should remove argument values' inner quote once it gets `=`. Whatever it's a flag or not, and it also replace from `\"` to `"` before passing it to external commands. # User-Facing Changes Given the shell script: ```shell # test.sh echo $@ ``` ## Before ``` > sh test.sh -ldflags="-s -w" github.com -ldflags="-s -w" github.com > sh test.sh exp='-s -w' github.com exp='-s -w' github.com ``` ## After ``` > sh test.sh -ldflags="-s -w" github.com -ldflags=-s -w github.com > sh test.sh exp='-s -w' github.com exp=-s -w github.com ``` # Tests + Formatting Added some tests
This commit is contained in:
@ -590,4 +590,18 @@ mod external_command_arguments {
|
||||
|
||||
assert_eq!(actual.out, "a;&$(hello)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_quotes_in_shell_arguments() {
|
||||
let actual = nu!("nu --testbin cococo expression='-r -w'");
|
||||
assert_eq!(actual.out, "expression=-r -w");
|
||||
let actual = nu!(r#"nu --testbin cococo expression="-r -w""#);
|
||||
assert_eq!(actual.out, "expression=-r -w");
|
||||
let actual = nu!("nu --testbin cococo expression='-r -w'");
|
||||
assert_eq!(actual.out, "expression=-r -w");
|
||||
let actual = nu!(r#"nu --testbin cococo expression="-r\" -w""#);
|
||||
assert_eq!(actual.out, r#"expression=-r" -w"#);
|
||||
let actual = nu!(r#"nu --testbin cococo expression='-r\" -w'"#);
|
||||
assert_eq!(actual.out, r#"expression=-r\" -w"#);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user