Package-level declarations
Types
Instances of the ChildProcess
represent spawned child processes.
Functions
Spawns a shell then executes the command
within that shell, buffering any generated output. The command
string passed to the exec function is processed directly by the shell and special characters (vary based on shell) need to be dealt with accordingly:
The child_process.execFile()
function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified executable file
is spawned directly as a new process making it slightly more efficient than {@link exec}.
The child_process.execFileSync()
method is generally identical to {@link execFile} with the exception that the method 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.
The child_process.execSync()
method is generally identical to {@link exec} with the exception that the method 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. If the child process intercepts and handles the SIGTERM
signal and doesn't exit, the parent process will wait until the child process has exited.
The child_process.fork()
method is a special case of {@link spawn} used specifically to spawn new Node.js processes. Like {@link spawn}, a ChildProcess
object is returned. The returned ChildProcess
will have an additional communication channel built-in that allows messages to be passed back and forth between the parent and child. See subprocess.send()
for details.
The child_process.spawn()
method spawns a new process using the given command
, with command-line arguments in args
. If omitted, args
defaults to an empty array.
The child_process.spawnSync()
method is generally identical to {@link spawn} with the exception that the function 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. If the process intercepts and handles the SIGTERM
signal and doesn't exit, the parent process will wait until the child process has exited.