enum abstract ChildProcessEvent<T>(Event<T>)
package js.node.child_process
to Event<T>
import js.node.child_process.ChildProcess
Enumeration of events emitted by ChildProcess
objects.
Variables
inlineread onlyClose:ChildProcessEvent<(Int, String) ‑> Void> = "close"
This event is emitted when the stdio streams of a child process have all terminated.
This is distinct from Exit
, since multiple processes might share the same stdio streams.
Listener arguments:
code - the exit code, if it exited normally.
signal - the signal passed to kill the child process, if it was killed by the parent.
inlineread onlyDisconnect:ChildProcessEvent<() ‑> Void> = "disconnect"
This event is emitted after calling the disconnect
method in the parent or in the child.
After disconnecting it is no longer possible to send messages, and the connected
property is false.
inlineread onlyError:ChildProcessEvent<Error ‑> Void> = "error"
Emitted when: 1. The process could not be spawned, or 2. The process could not be killed, or 3. Sending a message to the child process failed for whatever reason.
Note that the exit-event may or may not fire after an error has occured.
If you are listening on both events to fire a function, remember to guard against calling your function twice.
See also `ChildProcess.kill` and `ChildProcess.send`.
inlineread onlyExit:ChildProcessEvent<(Int, String) ‑> Void> = "exit"
This event is emitted after the child process ends.
Listener arguments:
code - the exit code, if it exited normally.
signal - the signal passed to kill the child process, if it was killed by the parent.
If the process terminated normally, code
is the final exit code of the process, otherwise null.
If the process terminated due to receipt of a signal, signal
is the string name of the signal, otherwise null.
Note that the child process stdio streams might still be open.
Also, note that node establishes signal handlers for 'SIGINT' and 'SIGTERM', so it will not terminate due to receipt of those signals, it will exit. See waitpid(2).
inlineread onlyMessage:ChildProcessEvent<(Dynamic, Dynamic) ‑> Void> = "message"
Messages send by send
are obtained using the message event.
This event can also be listened on the process
object to receive messages from the parent.
Listener arguments:
message - a parsed JSON object or primitive value
sendHandle - a Socket or Server object