-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Output from Deno.run Hangs If stdin
is Not Closed
#7727
Comments
Same result with the following example:
It hangs, but if you add |
This only seems to be a problem when the sub process is directly asking for input |
Tried it in Rust too (hoping to use Rust for this instead due to this issue) but i came across the same problem, though unsure if this is due to my inexperience with Rust (very very new to it) |
Any updates on this? If there is a workaround available, can it be noted here? I'm running into the same issue. |
Translated to const p = (new Deno.Command("bash", {
args: ["./cli/tests/testdata/ask.sh"],
stdin: "piped",
stdout: "piped",
})).spawn();
const writer = p.stdin.getWriter();
await writer.write(new TextEncoder().encode(`window.location.href\n`));
const reader = p.stdout.getReader();
console.log(
" read",
`"${new TextDecoder().decode((await reader.read()).value)}"`,
); # ask.sh
read -p "name" input
echo $input |
|
I have checked with all other
Deno.run
issues and whilst some are similar, they dont have the same issueDescription
I am creating a subprocess, and wanting to write to it and get output. Rise and repeat this X times
Code I Am Using
I can stop it from hanging by doing
p.stdin.close()
before thefor await
, but then i can't write anymoreWhat I Want To Be Able To Do
The text was updated successfully, but these errors were encountered: