ChildProcessHandle
Node API: Child Process
Object returned from async process spawn/exec methods which provide access to the underlying child process; the object exposes access to the process pid, stdin, stdout, stderr, and terminal exit information, in the form of an exitCode, signalCode, killed state, and so on.
When this object is first created and provided, the child process backing the object may still be alive (in many cases, such as long-running server processes, this is intended behavior).
If the backing process is still alive, terminal information will not be available, and signalCode, exitCode, and related properties return null
.
When the process exits, or is terminated through a signal, these fields are filled in by the runtime and become visible to the caller.
Properties
Channel used to communicate with the underlying process.
Terminal signal code for the process, or null
if the subprocess terminated normally.
Standard error stream for the child process.
Standard input stream for the child process.
Standard error output stream for the child process.
Standard output stream for the child process.
Functions
Alias for emitter.on(eventName, listener)
.
Disconnects the child process from the parent.
Dispatches the event to the list of handlers for Event.type.
Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbol
s.
Returns the current max listener value for the emitter.
Returns the number of listeners listening to the event named eventName.
Returns an array listing the listeners for the specified event.
Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added.
Adds a one-time listener function for the event named eventName to the beginning of the listener array. The next time eventName is triggered, this listener is removed, and then invoked.
Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()
).
Removes all listeners, or those of the specified eventName
.
Removes all listeners, or those of the specified eventName.
Removes the listener
from the list of handlers for event type
.
Sets the maximum number of listeners for the emitter.