summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
authorCharlie Moog <moogcharlie@gmail.com>2021-06-21 21:39:59 -0500
committerGitHub <noreply@github.com>2021-06-22 04:39:59 +0200
commit580c9f9ef02f8e8226437137867d3edeb9241b5e (patch)
tree5ded4031ae8be3d433b477db188268ebe2768e68 /cli/tests/integration_tests.rs
parent188222b893624438f3e5e77c7d8b9871beb02c70 (diff)
fix(core): don't panic on stdout/stderr write failures in Deno.core.print (#11039)
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index ce4c8d7d8..da436b5bd 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -3230,6 +3230,29 @@ console.log("finish");
util::test_pty(args, output, input);
}
+ #[test]
+ fn broken_stdout() {
+ 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::root_path())
+ .arg("eval")
+ .arg("console.log(3.14)")
+ .stdout(writer)
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap()
+ .wait_with_output()
+ .unwrap();
+
+ assert!(!output.status.success());
+ let stderr = std::str::from_utf8(output.stderr.as_ref()).unwrap().trim();
+ assert!(stderr.contains("Uncaught BrokenPipe"));
+ assert!(!stderr.contains("panic"));
+ }
+
itest!(_091_use_define_for_class_fields {
args: "run 091_use_define_for_class_fields.ts",
output: "091_use_define_for_class_fields.ts.out",