You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
readline/promises question results in unsettled top-level await when reading script from stdin #60344
changed the title [-]Promise readline question results in unsettled promise[/-][+]Promise readline question results in unsettled promise when reading script from stdin[/+]on Oct 21, 2025
changed the title [-]Promise readline question results in unsettled promise when reading script from stdin[/-][+]readline/promises question results in unsettled top-level await when reading script from stdin[/+]on Oct 21, 2025
cat closes the stdin once it has read all the files you passed to it, so to me it seems to be working as expected. To clarify, cat test.js | node pipes the stdout of cat test.js into the stdin of node; if you try to re-use stdin from within node, you would find only the script you're trying to run (which is already closed by the time node runs the code since it needs to parse the full source before eval).
Ah, I'd sort of hoped I could use this to run an interactive installation wizard like curl https://mywebsite.com/install.js | node. But seems I'll just have to use npx then if this is not something node's stdin handling allows. Thanks, feel free to close this then.
If you run curl https://mywebsite.com/install.js | node and input stuff in the terminal, it's going to curl's stdin, not node's. There's nothing special about Node.js btw, it's just how piping works in POSIX-complient systems.
Activity
[-]Promise readline question results in unsettled promise[/-][+]Promise readline question results in unsettled promise when reading script from stdin[/+][-]Promise readline question results in unsettled promise when reading script from stdin[/-][+]readline/promises question results in unsettled top-level await when reading script from stdin[/+]aduh95 commentedon Oct 22, 2025
Why is that the expected behavior? What do you expect instead?
mb21 commentedon Oct 22, 2025
@aduh95 Why do I expect the program to not terminate? Because the example is pretty much verbatim from https://nodejs.org/api/readline.html#readline where it says:
Again, this happens only with
cat test.js | node. So I imagine there's a bug in the stdin/eval handling somewhere.Edit: ah, or do you think this doesn't work because stdin is already used to read in the script so I cannot use it anymore from the script itself?
aduh95 commentedon Oct 22, 2025
catcloses the stdin once it has read all the files you passed to it, so to me it seems to be working as expected. To clarify,cat test.js | nodepipes the stdout ofcat test.jsinto the stdin ofnode; if you try to re-use stdin from withinnode, you would find only the script you're trying to run (which is already closed by the timenoderuns the code since it needs to parse the full source before eval).mb21 commentedon Oct 22, 2025
Ah, I'd sort of hoped I could use this to run an interactive installation wizard like
curl https://mywebsite.com/install.js | node. But seems I'll just have to usenpxthen if this is not something node's stdin handling allows. Thanks, feel free to close this then.aduh95 commentedon Oct 22, 2025
If you run
curl https://mywebsite.com/install.js | nodeand input stuff in the terminal, it's going tocurl's stdin, notnode's. There's nothing special about Node.js btw, it's just how piping works in POSIX-complient systems.fix(cli): dev-run prompt channel — stderr fallback + stdin-keyed term…