Lines Matching refs:child_process
7 <!-- source_link=lib/child_process.js -->
9 The `child_process` module provides the ability to spawn subprocesses in
11 is primarily provided by the [`child_process.spawn()`][] function:
14 const { spawn } = require('child_process');
49 The [`child_process.spawn()`][] method spawns the child process asynchronously,
50 without blocking the Node.js event loop. The [`child_process.spawnSync()`][]
54 For convenience, the `child_process` module provides a handful of synchronous
55 and asynchronous alternatives to [`child_process.spawn()`][] and
56 [`child_process.spawnSync()`][]. Each of these alternatives are implemented on
57 top of [`child_process.spawn()`][] or [`child_process.spawnSync()`][].
59 * [`child_process.exec()`][]: spawns a shell and runs a command within that
62 * [`child_process.execFile()`][]: similar to [`child_process.exec()`][] except
65 * [`child_process.fork()`][]: spawns a new Node.js process and invokes a
68 * [`child_process.execSync()`][]: a synchronous version of
69 [`child_process.exec()`][] that will block the Node.js event loop.
70 * [`child_process.execFileSync()`][]: a synchronous version of
71 [`child_process.execFile()`][] that will block the Node.js event loop.
80 The [`child_process.spawn()`][], [`child_process.fork()`][], [`child_process.exec()`][],
81 and [`child_process.execFile()`][] methods all follow the idiomatic asynchronous
89 The [`child_process.exec()`][] and [`child_process.execFile()`][] methods
95 The importance of the distinction between [`child_process.exec()`][] and
96 [`child_process.execFile()`][] can vary based on platform. On Unix-type
97 operating systems (Unix, Linux, macOS) [`child_process.execFile()`][] can be
100 terminal, and therefore cannot be launched using [`child_process.execFile()`][].
102 [`child_process.spawn()`][] with the `shell` option set, with
103 [`child_process.exec()`][], or by spawning `cmd.exe` and passing the `.bat` or
105 [`child_process.exec()`][] do). In any case, if the script filename contains
110 const { spawn } = require('child_process');
128 const { exec, spawn } = require('child_process');
145 ### `child_process.exec(command[, options][, callback])`
195 const { exec } = require('child_process');
223 const { exec } = require('child_process');
238 Unlike the exec(3) POSIX system call, `child_process.exec()` does not replace
250 const exec = util.promisify(require('child_process').exec);
265 const { exec } = require('child_process');
274 ### `child_process.execFile(file[, args][, options][, callback])`
320 The `child_process.execFile()` function is similar to [`child_process.exec()`][]
323 efficient than [`child_process.exec()`][].
325 The same options as [`child_process.exec()`][] are supported. Since a shell is
330 const { execFile } = require('child_process');
355 const execFile = util.promisify(require('child_process').execFile);
372 const { execFile } = require('child_process');
381 ### `child_process.fork(modulePath[, args][, options])`
432 the `'pipe'` and `'inherit'` options for [`child_process.spawn()`][]'s
434 * `stdio` {Array|string} See [`child_process.spawn()`][]'s [`stdio`][].
445 The `child_process.fork()` method is a special case of
446 [`child_process.spawn()`][] used specifically to spawn new Node.js processes.
447 Like [`child_process.spawn()`][], a [`ChildProcess`][] object is returned. The
459 By default, `child_process.fork()` will spawn new Node.js instances using the
467 Unlike the fork(2) POSIX system call, `child_process.fork()` does not clone the
470 The `shell` option available in [`child_process.spawn()`][] is not supported by
471 `child_process.fork()` and will be ignored if set.
483 const { fork } = require('child_process');
494 ### `child_process.spawn(command[, args][, options])`
562 The `child_process.spawn()` method spawns a new process using the given
594 const { spawn } = require('child_process');
613 const { spawn } = require('child_process');
650 const { spawn } = require('child_process');
671 const { spawn } = require('child_process');
713 const { spawn } = require('child_process');
727 const { spawn } = require('child_process');
772 `child_process` object as [`subprocess.stdio[fd]`][`subprocess.stdio`]. Pipes
815 const { spawn } = require('child_process');
835 On Unix-like operating systems, the [`child_process.spawn()`][] method
838 [`child_process.spawn()`][] calls to be a bottleneck. For more information,
841 See also: [`child_process.exec()`][] and [`child_process.fork()`][].
845 The [`child_process.spawnSync()`][], [`child_process.execSync()`][], and
846 [`child_process.execFileSync()`][] methods are synchronous and will block the
854 ### `child_process.execFileSync(file[, args][, options])`
909 The `child_process.execFileSync()` method is generally identical to
910 [`child_process.execFile()`][] with the exception that the method will not
921 [`child_process.spawnSync()`][].
927 ### `child_process.execSync(command[, options])`
976 The `child_process.execSync()` method is generally identical to
977 [`child_process.exec()`][] with the exception that the method will not return
986 [`child_process.spawnSync()`][].
991 ### `child_process.spawnSync(command[, args][, options])`
1062 The `child_process.spawnSync()` method is generally identical to
1063 [`child_process.spawn()`][] with the exception that the function will not return
1084 use the [`child_process.spawn()`][], [`child_process.exec()`][],
1085 [`child_process.execFile()`][], or [`child_process.fork()`][] methods to create
1103 const { spawn } = require('child_process');
1263 [`child_process.fork()`][]), the `process.disconnect()` method can be invoked
1287 const { spawn } = require('child_process');
1321 const { spawn } = require('child_process');
1364 const { spawn } = require('child_process');
1381 const { spawn } = require('child_process');
1420 i.e. when using [`child_process.fork()`][]), the `subprocess.send()` method can
1430 const cp = require('child_process');
1488 const subprocess = require('child_process').fork('subprocess.js');
1528 const { fork } = require('child_process');
1592 For [`child_process.fork()`][], its value will be equal to
1594 For [`child_process.spawn()`][], its value will be the name of
1596 For [`child_process.exec()`][], its value will be the name of the shell
1646 the [`stdio`][] option passed to [`child_process.spawn()`][] that have been set
1658 const child_process = require('child_process');
1660 const subprocess = child_process.spawn('ls', {
1697 const { spawn } = require('child_process');
1722 const { spawn } = require('child_process');
1750 the same requirement. Thus, in `child_process` functions where a shell can be
1772 `serialization` option to `'advanced'` when calling [`child_process.spawn()`][]
1773 or [`child_process.fork()`][].
1787 [`child_process.exec()`]: #child_process_child_process_exec_command_options_callback
1788 [`child_process.execFile()`]: #child_process_child_process_execfile_file_args_options_callback
1789 [`child_process.execFileSync()`]: #child_process_child_process_execfilesync_file_args_options
1790 [`child_process.execSync()`]: #child_process_child_process_execsync_command_options
1791 [`child_process.fork()`]: #child_process_child_process_fork_modulepath_args_options
1792 [`child_process.spawn()`]: #child_process_child_process_spawn_command_args_options
1793 [`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options