diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/run_tests.rs | 14 | ||||
-rw-r--r-- | tests/testdata/run/process_stdin_unblock.mjs | 21 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 91370a87c..f7aaa9daf 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -3142,6 +3142,20 @@ itest!(byte_order_mark { }); #[test] +#[cfg(windows)] +fn process_stdin_read_unblock() { + TestContext::default() + .new_command() + .args_vec(["run", "run/process_stdin_unblock.mjs"]) + .with_pty(|mut console| { + console.write_raw("b"); + console.human_delay(); + console.write_line_raw("s"); + console.expect_all(&["1", "1"]); + }); +} + +#[test] fn issue9750() { TestContext::default() .new_command() diff --git a/tests/testdata/run/process_stdin_unblock.mjs b/tests/testdata/run/process_stdin_unblock.mjs new file mode 100644 index 000000000..bbeea2afb --- /dev/null +++ b/tests/testdata/run/process_stdin_unblock.mjs @@ -0,0 +1,21 @@ +import process from "node:process"; + +function prompt() { + process.stdin.setRawMode(true); + + const { promise, resolve } = Promise.withResolvers(); + + const onData = (buf) => { + process.stdin.setRawMode(false); + process.stdin.removeListener("data", onData); + console.log(buf.length); + resolve(); + }; + + process.stdin.on("data", onData); + return promise; +} + +await prompt(); +await prompt(); +Deno.exit(0); |