Add support to run external command with string evaluation (#3611)

This commit is contained in:
Võ Anh Duy
2021-06-14 08:20:07 +08:00
committed by GitHub
parent 2846e3f5d9
commit 721f704260
2 changed files with 29 additions and 14 deletions

View File

@ -68,6 +68,18 @@ fn correctly_escape_external_arguments() {
assert_eq!(actual.out, "$0");
}
#[test]
fn execute_binary_in_string() {
let actual = nu!(
cwd: ".",
r#"
let cmd = echo
^$"($cmd)" '$0'
"#);
assert_eq!(actual.out, "$0");
}
#[test]
fn redirects_custom_command_external() {
let actual = nu!(cwd: ".", r#"def foo [] { nu --testbin cococo foo bar }; foo | str length "#);