diff options
author | melbourne2991 <4619280+melbourne2991@users.noreply.github.com> | 2024-08-20 10:21:12 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 00:21:12 +0000 |
commit | 0eba180fdbfdc19e15c743f00382d3fc79f65a10 (patch) | |
tree | ca6169345b4fa2352874413096088a9b2e7416c6 /tests/integration/run_tests.rs | |
parent | 1c4db2aca93aa248e501ea2de9fe4b399eeb5cfd (diff) |
fix(repl): Prevent panic on broken pipe (#21945)
Diffstat (limited to 'tests/integration/run_tests.rs')
-rw-r--r-- | tests/integration/run_tests.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 0b3d85deb..c6637e005 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -4343,6 +4343,32 @@ fn broken_stdout() { assert!(!stderr.contains("panic")); } +#[test] +fn broken_stdout_repl() { + let (reader, writer) = os_pipe::pipe().unwrap(); + // drop the reader to create a broken pipe + drop(reader); + + let output = util::deno_cmd() + .current_dir(util::testdata_path()) + .arg("repl") + .stdout(writer) + .stderr_piped() + .spawn() + .unwrap() + .wait_with_output() + .unwrap(); + + assert!(!output.status.success()); + let stderr = std::str::from_utf8(output.stderr.as_ref()).unwrap().trim(); + if cfg!(windows) { + assert_contains!(stderr, "The pipe is being closed. (os error 232)"); + } else { + assert_contains!(stderr, "Broken pipe (os error 32)"); + } + assert_not_contains!(stderr, "panic"); +} + itest!(error_cause { args: "run run/error_cause.ts", output: "run/error_cause.ts.out", |