-
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
Bug: Missing stdio pipes with node:child_process
on Windows
#23524
Comments
@marvinhagemeister The docs only very briefly mention the ability to open other file descriptors https://nodejs.org/api/child_process.html#optionsstdio Is there any explainer anywhere on how they should behave? |
I'm not aware of any explainer. I don't know how they're supposed to work either. One would probably look at the Node source code to get an answer to that. |
There isn't almost a day that goes by that I don't wish I had this working so that I could use Playwright from Deno. In fact, it is the only thing keeping my current work project on Node. If I wanted to take a stab at implementing this, do you have any pointers on where I should start? |
@cowboyd See https://github.com/denoland/deno/blob/v1.45.1/ext/node/polyfills/internal/child_process.ts#L178 . Here, the stream specifiers after the first three are discarded. We need to figure out how to handle this and pass it to Footnotes |
#24106 introduces changes to enable Deno's |
I've delved deeper into how we might implement this feature. Here's what I've found: We can use a pair of pipes returned by Unfortunately, there doesn't seem to be a cross-platform way to pass "pipes" to child processes. On Unix systems, pipes are just file descriptors. The On Windows, pipes are Footnotes
|
@uasi This is fantastic research, and very enlightening about where exactly to look :)
This seems like a pretty heavy lift to not only implement but maintain a bespoke equivalent of |
@cowboyd I think the chances are low. The challenges have been discussed in a PR1 proposing an RFC about the exact API for that. As said in rust-lang/rfcs#2939 (comment) , however, we could implement it on our side relatively easily if the std lib provides a Windows-only Or we could set aside Windows support for now and make it work on Unix first. Footnotes |
I'm looking into this currently |
This is now fixed on macOS and linux. As mentioned above windows is trickier, so that will come in a future PR. |
node:child_process
node:child_process
on Windows
Update: This issue is now resolved on unix platforms (macOS and linux), but is not yet fixed on Windows.
Tried the current state of running
playwright
in Deno (see #16899) and ran into an issue regarding the pipes set up fornode:child_process.spawn()
. The launcher code can be found here https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/utils/processLauncher.ts#L133They expect to receive 5 streams to be set up, but we only set up the first three. I created a minimal reproduction out of that:
Steps to reproduce
main.mjs
with these contentsDENO_FUTURE=1 deno run -A main.mjs
Can also be run in Node for comparison
node main.mjs
Version: Deno 1.42.4 (git 5294885 2024-04-24)
The text was updated successfully, but these errors were encountered: