Child Process

Introduced in 4.0.0

Stability: 2 - Stable

const ChildProcess = require('kado/lib/ChildProcess')

This library provides an enhanced interface to use Node.js core child_process module.

NOTE: This library is not to be confused with the core ChildProcess object which is used internally.

Class: ChildProcess extends EventEmitter

ChildProcess.constructor(options)

ChildProcess.setEnv(env)

ChildProcess.getEnv()

ChildProcess.setPath(path)

Change the path of the child process after instantiation.

ChildProcess.send(message, sendHandler, options)

ChildProcess.kill(signal = 'SIGTERM')

ChildProcess.start()

ChildProcess.stop()

ChildProcess.setStatus(status)

Change the state of the child process instance.

Internal Use

ChildProcess.onExit(signal = 'SIGKILL')

Internal Use

ChildProcess.registerExitHandler()

Internal Use

ChildProcess.handleMessage(proc, message)

Passes the messages upwards via the message event.

Internal Use

ChildProcess.respawnChild()

If the child is closed, and respawns are enabled and the state of the class is started = true this will start a new child process in the previous processes place.

Internal Use

ChildProcess.addChild(proc)

This method will take a newly forked process and wrap it to work properly with the ChildProcess internals.

Internal Use

ChildProcess.stopChild(proc)

Internal Use