Process object

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. 

Properties

running
- boolean, process running state, true - process is alive.

Methods

exec
( exepath: string [, arg1: string, arg2: string, ...] [,#detached] ) : Process

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.

on
( event: string, callback: function ) : this

Subscribes the callback function to one of process events:

The event name may contain ".namespace" part that can be used in .off() call.

off
( event: string | callback: function ) : this

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.

send
( data: string ) : this

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).

terminate
( )

Makes an attempt to terminate the child process.