https://github.com/abbotto/shellcmd
Run shell commands from NodeJS
https://github.com/abbotto/shellcmd
command-line javascript nodejs script shell terminal tool
Last synced: 3 months ago
JSON representation
Run shell commands from NodeJS
- Host: GitHub
- URL: https://github.com/abbotto/shellcmd
- Owner: abbotto
- License: mit
- Created: 2017-10-09T22:37:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-16T16:20:21.000Z (over 7 years ago)
- Last Synced: 2026-01-03T22:58:34.139Z (6 months ago)
- Topics: command-line, javascript, nodejs, script, shell, terminal, tool
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Run shell commands from NodeJS
## Package Information
[](http://badge.fury.io/js/shellcmd)
[](https://badge.fury.io/gh/abbotto%2Fshellcmd)
## Usage
require('shellcmd')(
'cmd 1',
'cmd 2',
'cmd n',
'...',
{ options }
, 1
)
### Force `stdout` output for errors
When `1` is passed as the final argument, `stdout` will be returned instead of an object when an error is encountered.
## Options [Object]
- `cwd` [string]
- Current working directory of the child process
- `env` [object]
- Environment key-value pairs
- `encoding` [string]
- Default: 'utf8'
- `shell` [string]
- Shell where the command will be executed
- Default:
- UNIX: `/bin/sh`
- Windows: `process.env.ComSpec`
- `timeout` [number]
- Default: 0
- `maxBuffer` [number]
- Largest amount of data in bytes allowed on stdout or stderr.
- If exceeded, the child process is terminated.
- Default: 200*1024
- `killSignal` [string | integer]
- Default: 'SIGTERM'
- `uid` [number]
- Sets the user identity of the process.
- `gid` [number]
- Sets the group identity of the process.