diff options
author | Maayan Hanin <maayan.asa.hanin@gmail.com> | 2020-07-09 22:06:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 21:06:51 +0200 |
commit | edb7a0eead3604316b3cca2ac9122c5599445a63 (patch) | |
tree | e8d7fe06992decf52c81678b4c000a6edeb922fd /test_util/src | |
parent | 202e7fa6ad366ee56a6d070e94eaecb6dbc745bf (diff) |
fix(cli): panic when stdio is null on windows (#6528)
Fixes: #6409
Diffstat (limited to 'test_util/src')
-rw-r--r-- | test_util/src/lib.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index fb7b8f88e..73a1df043 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -591,6 +591,37 @@ pub fn run_python_script(script: &str) { } } +pub fn run_powershell_script_file( + script_file_path: &str, + args: Vec<&str>, +) -> Result<(), i64> { + let deno_dir = new_deno_dir(); + let mut command = Command::new("powershell.exe"); + + command + .env("DENO_DIR", deno_dir.path()) + .current_dir(root_path()) + .arg("-file") + .arg(script_file_path); + + for arg in args { + command.arg(arg); + } + + let output = command.output().expect("failed to spawn script"); + let stdout = String::from_utf8(output.stdout).unwrap(); + let stderr = String::from_utf8(output.stderr).unwrap(); + println!("{}", stdout); + if !output.status.success() { + panic!( + "{} executed with failing error code\n{}{}", + script_file_path, stdout, stderr + ); + } + + Ok(()) +} + #[derive(Debug, Default)] pub struct CheckOutputIntegrationTest { pub args: &'static str, |