dev-notes/Node.js/Standard Packages/child_process.md

23 lines
485 B
Markdown
Raw Normal View History

2021-01-31 11:05:37 +01:00
# 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'});
```