| hide_title | true |
|---|---|
| custom_edit_url | |
| pagination_prev | |
| pagination_next |
Home > @rushstack/node-core-library > Executable > spawn
Start a child process.
Signature:
static spawn(filename: string, args: string[], options?: IExecutableSpawnOptions): child_process.ChildProcess;|
Parameter |
Type |
Description |
|---|---|---|
|
filename |
string |
The name of the executable file. This string must not contain any command-line arguments. If the name contains any path delimiters, then the shell's default PATH will not be searched. |
|
args |
string[] |
The command-line arguments to be passed to the process. |
|
options |
(Optional) Additional options |
Returns:
child_process.ChildProcess
the same data type as returned by the NodeJS child_process.spawnSync() API
This function is similar to child_process.spawn(). The main differences are:
- It does not invoke the OS shell unless the executable file is a shell script. - Command-line arguments containing special characters are more accurately passed through to the child process. - If the filename is missing a path, then the shell's default PATH will be searched. - If the filename is missing a file extension, then Windows default file extensions will be searched.
This command is asynchronous, but it does not return a Promise<></>. Instead it returns a Node.js ChildProcess supporting event notifications.