Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/microsoft/run-in-terminal
https://github.com/microsoft/run-in-terminal
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/microsoft/run-in-terminal
- Owner: microsoft
- License: mit
- Archived: true
- Created: 2015-10-13T13:42:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-09-22T23:56:39.000Z (about 2 years ago)
- Last Synced: 2024-05-09T17:48:44.683Z (6 months ago)
- Language: TypeScript
- Size: 37.1 KB
- Stars: 21
- Watchers: 9
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# run-in-terminal
[![npm package](https://img.shields.io/npm/v/run-in-terminal.svg)](https://www.npmjs.com/package/run-in-terminal)
[![NPM downloads](https://img.shields.io/npm/dm/run-in-terminal.svg)](https://www.npmjs.com/package/run-in-terminal)Runs a command in a terminal (cmd.exe, gnome-terminal, Terminal) window.
## Installation
```sh
$ npm i run-in-terminal
```## Usage
```js
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](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
#### 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](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
##### cwd
Type: `string`
Default: `process.cwd()`Current working directory of the child process.
## License
MIT