mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-04-07 03:16:41 +00:00
23 lines
485 B
Markdown
23 lines
485 B
Markdown
|
# Child Process Module
|
||
|
|
||
|
## Spawning
|
||
|
|
||
|
```js
|
||
|
child_process.spawn(command, args, options); // spawn a child process
|
||
|
|
||
|
// On Windows, setting options.detached to true makes it possible for the child process to continue running after the parent exits
|
||
|
child_process.spawn(command, args, {
|
||
|
detached: true
|
||
|
});
|
||
|
```
|
||
|
|
||
|
## Using The System Shell
|
||
|
|
||
|
```js
|
||
|
exec("command args", {'shell':'powershell.exe'}, (err, stdout, stderr) => {
|
||
|
|
||
|
});
|
||
|
|
||
|
execSync("command args", {'shell':'powershell.exe'});
|
||
|
```
|