mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fix bug with multiple input objects to an external command.
Previously, we would build a command that looked something like this: <ex_cmd> "$it" "&&" "<ex_cmd>" "$it" So that the "&&" and "<ex_cmd>" would also be arguments to the command, instead of a chained command. This commit builds up a command string that can be passed to an external shell.
This commit is contained in:
@ -164,6 +164,28 @@ fn save_figures_out_intelligently_where_to_write_out_with_metadata() {
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_arg_works_with_many_inputs_to_external_command() {
|
||||
Playground::setup("it_arg_works_with_many_inputs", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![
|
||||
FileWithContent("file1", "text"),
|
||||
FileWithContent("file2", " and more text"),
|
||||
]);
|
||||
|
||||
let (stdout, stderr) = nu_combined!(
|
||||
cwd: dirs.test(), h::pipeline(
|
||||
r#"
|
||||
echo file1 file2
|
||||
| split-row " "
|
||||
| cat $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!("text and more text", stdout);
|
||||
assert!(!stderr.contains("No such file or directory"));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn save_can_write_out_csv() {
|
||||
Playground::setup("save_test_2", |dirs, _| {
|
||||
|
Reference in New Issue
Block a user