-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Handing spawn() stdio as socket wont duplex properly #15714
Copy link
Copy link
Closed
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Metadata
Metadata
Assignees
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm trying to implement a sort of
PassThrough-style stream that can be used as mock stdio forChildProcess.spawn().PassThroughitself isn't appropriate because it doesn't have a file descriptor. So I'm doing this by creating a socket that speaks to an echo server. What I'm finding is that the server receives the data and successfully pipes it, but the passthrough socket never seems to receive it.I've poked around the node internals a bit to figure-out why, but I don't have much to share at this time. It looks like
spawn()may create another socket that's readable and not writable, and uses the socket I passed as its handle [here]. But my socket remains readable and writable as I would expect, so I still can't explain the behavior!Possibly related to #9413. Here's some code to reproduce the issue and play with.
For my purposes I'm all set– I can use
stdio: 'pipe'and pipe the process's stdio thru actual passthrough streams. This is still a curiosity, though!