Class: ChildProcess

ChildProcess

Class wrapper for child_process.fork

new Launchers.ChildProcess(options)

launchers/childprocess.js, line 24

Create a new child process worker using child_process.fork

Name Type Description
options object

options or name of script to execute

Name Type Description
source string

Name of script to execute

args Array

Any arguments to pass to the script

options object

Additional options to pass to child_process.fork

...args

Any arguments to pass to the script

Methods

emit(event, data, callback)

launchers/childprocess.js, line 60

Send a message to the worker process

Name Type Description
event string

Name of the event to send

data any

What data to send

callback function

Callback called when complete

kill(signal)

launchers/childprocess.js, line 51

Terminates the child process with signal

Name Type Default Description
signal string SIGTERM

Signal to send to child process, defaults to 'SIGTERM'

on(event, handler)

launchers/childprocess.js, line 75

Setup a listener for an event. Called every time the worker gets the event.

Name Type Description
event string

What even to listen for

handler function

function(data, done) handler for the event

Name Type Description
data any

Data to be processed

done function

Function to return results to the manager

once(event, handler)

launchers/childprocess.js, line 83

Setup a listener for an event. Called only once, then removed.

Name Type Description
event string

What even to listen for

handler function

function(data) handler for the event

send()

launchers/childprocess.js, line 90

Private internal, used to actually send messages back to the master process. See Node.js documentation for process.send for more info.