ChildProcess

js.node.ChildProcess (extern class)

Static Members

Launches a new process with the given command, with command line arguments in args. If omitted, args defaults to an empty Array.

The third argument is used to specify additional options, which defaults to: { cwd: null, env: process.env }

Note that if spawn receives an empty options object, it will result in spawning the process with an empty environment rather than using process.env. This due to backwards compatibility issues with a deprecated API.

Name Type Default
command String
args Array<String> (optional)
Returns
js.node.child_process._ChildProcess.ChildProcessObject

Runs a command in a shell and buffers the output.

command is the command to run, with space-separated arguments.

The default options are: { encoding: 'utf8', timeout: 0, maxBuffer: 200*1024, killSignal: 'SIGTERM', cwd: null, env: null }

Name Type
command String
callback ChildProcessExecCallback
Returns
js.node.child_process._ChildProcess.ChildProcessObject

This is similar to exec except it does not execute a subshell but rather the specified file directly. This makes it slightly leaner than exec

Name Type Default
file String
callback Null<ChildProcessExecCallback> (optional)
Returns
js.node.child_process._ChildProcess.ChildProcessObject

This is a special case of the spawn functionality for spawning Node processes. In addition to having all the methods in a normal ChildProcess instance, the returned object has a communication channel built-in. See send for details.

Name Type Default
modulePath String
args Array<String> (optional)
Returns
js.node.child_process._ChildProcess.ChildProcessObject

Synchronous version of spawn.

spawnSync will not return until the child process has fully closed. When a timeout has been encountered and killSignal is sent, the method won't return until the process has completely exited. That is to say, if the process handles the SIGTERM signal and doesn't exit, your process will wait until the child process has exited.

Name Type Default
command String
options Null<ChildProcessSpawnSyncOptions> (optional)
Returns
ChildProcessSpawnSyncResult

execFileSync(command: String, ?args: Array<String>): haxe.extern.EitherType<String, Buffer>

Synchronous version of execFile.

execFileSync will not return until the child process has fully closed. When a timeout has been encountered and killSignal is sent, the method won't return until the process has completely exited. That is to say, if the process handles the SIGTERM signal and doesn't exit, your process will wait until the child process has exited.

If the process times out, or has a non-zero exit code, this method will throw. The Error object will contain the entire result from spawnSync

Name Type Default
command String
args Array<String> (optional)
Returns
haxe.extern.EitherType<String, Buffer>

Synchronous version of exec.

execSync will not return until the child process has fully closed. When a timeout has been encountered and killSignal is sent, the method won't return until the process has completely exited. That is to say, if the process handles the SIGTERM signal and doesn't exit, your process will wait until the child process has exited.

If the process times out, or has a non-zero exit code, this method will throw. The Error object will contain the entire result from spawnSync

Name Type Default
command String
options Null<ChildProcessSpawnSyncOptions> (optional)
Returns
haxe.extern.EitherType<String, Buffer>

Metadata

Name Parameters
:jsRequire "child_process"