Using the Process class, your program can run another program as a subprocess, receiving its stdout and stderr output and passing data to its stdin stream.
Static method, constructs new child process proxy object and starts process by running executable on path with command line parameters (optional).
By default started process will belong to the same process group - will be terminated by itself or on exit of this process. But if #detached parameter is provided the child process will survive this process termination - torn off child process.
Subscribes the callback function to one of process events:
function(text:string)
, child process has printed the text in its stdout stream;function(text:string)
, child process has printed the text in its stderr stream;function()
, child process has received data that was sent by .send(data)
.function(status: integer)
, process terminated with the status code;The event name may contain ".namespace" part that can be used in .off() call.
Unsubscribe callback either by its name or by its function reference.
Event name may contain only namespace part, so this: socket.off(".namespace")
will unsubscribe all handlers that were set with that namespace.
The method sends data to the stdin stream of the child process.
If called more than once, this method shall be invoked only after completion of previous send operation (after receiving event stdin).
Makes an attempt to terminate the child process.