Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

child_process: Add 'close' event for child processes #2944

Closed
wants to merge 2 commits into from

Conversation

AvianFlu
Copy link

This patch changes the exit semantics of child processes so that two events are now emitted - exit and close - instead of just exit.

  • exit: The exit event is now fired when the spawned child process exits, regardless of the state of its stdio streams. The existing behavior was to wait for close events from all stdio streams before emitting exit, which would create various complex situations with inherited stdio handles. (see win: exit event not emitted as long as a grandchild still exists #2914)
  • close: A new close event is now fired in place of the old exit event, i.e. when close events have been received from all stdio streams.

Currently, a child process does not emit the 'exit' event until 'close' events
have been received on all three of the child's stdio streams.  This change makes
the child object emit 'exit' when the child exits, and a new 'close' event when
all stdio streams are closed.
@bnoordhuis
Copy link
Member

LGTM. Other committers?

@isaacs
Copy link

isaacs commented Mar 16, 2012

Squashed and landed on c7b8073.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants