run-in-terminal
March 6, 2019 ยท View on GitHub
Runs a command in a terminal (cmd.exe, gnome-terminal, Terminal) window.
Installation
$ npm i run-in-terminal
Usage
const { runInTerminal } = require('run-in-terminal');
runInTerminal('npm run watch');
runInTerminal('npm run watch').then(() => {
// the terminal closed
});
API
runInTerminal(command[, args[, options]])
Returns a promise for the spawned child process.
command
Type: string
The command to run in a terminal window.
args
Type: Array
List of string arguments.
options
Type: Object
See child_process.spawn() options.
cwd
Type: string
Default: process.cwd()
Current working directory of the child process.
License
MIT