diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/Cargo.toml | 3 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 23 |
2 files changed, 13 insertions, 13 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 347db66a2..732adebeb 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -94,6 +94,9 @@ chrono = "0.4.15" os_pipe = "0.9.2" test_util = { path = "../test_util" } +[target.'cfg(unix)'.dev-dependencies] +exec = "0.3.1" # Used in test_raw_tty + [package.metadata.winres] # This section defines the metadata that appears in the deno.exe PE header. OriginalFilename = "deno.exe" diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index a7e901d83..e57b682c5 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -176,8 +176,9 @@ fn no_color() { pub fn test_raw_tty() { use std::io::{Read, Write}; use util::pty::fork::*; + let deno_exe = util::deno_exe_path(); - let deno_dir = TempDir::new().expect("tempdir fail"); + let root_path = util::root_path(); let fork = Fork::from_ptmx().unwrap(); if let Ok(mut master) = fork.is_parent() { @@ -193,10 +194,10 @@ pub fn test_raw_tty() { master.write_all(b"c").unwrap(); nread = master.read(&mut obytes).unwrap(); assert_eq!(String::from_utf8_lossy(&obytes[0..nread]), "C"); + fork.wait().unwrap(); } else { use nix::sys::termios; use std::os::unix::io::AsRawFd; - use std::process::*; // Turn off echo such that parent is reading works properly. let stdin_fd = std::io::stdin().as_raw_fd(); @@ -204,20 +205,16 @@ pub fn test_raw_tty() { t.local_flags.remove(termios::LocalFlags::ECHO); termios::tcsetattr(stdin_fd, termios::SetArg::TCSANOW, &t).unwrap(); - let mut child = Command::new(deno_exe) - .env("DENO_DIR", deno_dir.path()) - .current_dir(util::root_path()) + std::env::set_current_dir(root_path).unwrap(); + let err = exec::Command::new(deno_exe) .arg("run") .arg("--unstable") + .arg("--quiet") + .arg("--no-check") .arg("cli/tests/raw_mode.ts") - .stdin(Stdio::inherit()) - .stdout(Stdio::inherit()) - // Warning: errors may be swallowed. Try to comment stderr null if - // experiencing problems. - .stderr(Stdio::null()) - .spawn() - .expect("Failed to spawn script"); - child.wait().unwrap(); + .exec(); + println!("err {}", err); + unreachable!() } } |