A tiny cross-platform promise based wrapper around child_process.spawn.
Install the package locally within you project folder with your package manager:
With npm
:
npm install shell-exec
With yarn
:
yarn add shell-exec
With pnpm
:
pnpm add shell-exec
import shellExec from 'shell-exec'
shellExec('echo Hi!').then(console.log).catch(console.log)
Parameters:
command
{String | Array} - String or Array of commands to runoptions
{Object} - Options object passed tochild_process.spawn
The function then returns a Promise
.
See the hosted docs here.
Got an idea for a new feature? Found a bug? Contributions are welcome! Please open up an issue or make a pull request.