Gathering detailed insights and metrics for exec-sh
Gathering detailed insights and metrics for exec-sh
Gathering detailed insights and metrics for exec-sh
Gathering detailed insights and metrics for exec-sh
shell-exec
A tiny cross-platform promise based wrapper around child_process.spawn.
shx
Portable Shell Commands for Node
grunt-sh
Grunt task for executing commands in a shell.
sh-exec
<p align="center"> <img src="./logo.png" width="128" /> </p> <p align="center"> <a href="https://www.npmjs.com/package/sh-exec"> <img src="https://img.shields.io/npm/v/sh-exec.svg?style=flat-square&" /> </a> <a href="https://travis-ci.org/rwu8
npm install exec-sh
Typescript
Module System
Node Version
NPM Version
JavaScript (96.09%)
TypeScript (3.91%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
64 Stars
75 Commits
9 Forks
2 Watchers
1 Branches
5 Contributors
Updated on Feb 05, 2025
Latest Version
0.4.0
Package Id
exec-sh@0.4.0
Size
8.11 kB
NPM Version
7.5.3
Node Version
15.10.0
Published on
Mar 26, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
9
Execute shell command forwarding all stdio streams.
exec-sh is a wrapper for child_process.spawn
with some improvements:
cmd /C COMMAND
sh -c COMMAND
execSh("bash")
execsh("echo -n Say: && read i && echo Said:$i")
execSh("pwd", console.log)
1// JavaScript 2 3execSh("echo hello exec-sh && bash", { cwd: "/home" }, function(err){ 4 if (err) { 5 console.log("Exit code: ", err.code); 6 } 7});
1# Terminal output: interactive bash session 2 3hello exec-sh 4bash-3.2$ pwd 5/home 6bash-3.2$ exit 99 7exit 8Exit code: 99
1const execSh = require("../"); 2 3// run interactive bash shell 4execSh("echo lorem && bash", { cwd: "/home" }, (err) => { 5 if (err) { 6 console.log("Exit code: ", err.code); 7 return; 8 } 9 10 // collect streams output 11 const child = execSh(["bash -c id", "echo lorem >&2"], true, 12 (err, stdout, stderr) => { 13 console.log("error: ", err); 14 console.log("stdout: ", stdout); 15 console.log("stderr: ", stderr); 16 }); 17});
1const execShPromise = require("exec-sh").promise; 2 3// run interactive bash shell 4const run = async () => { 5 let out; 6 7 try { 8 out = await execShPromise('pwd', true); 9 } catch (e) { 10 console.log('Error: ', e); 11 console.log('Stderr: ', e.stderr); 12 console.log('Stdout: ', e.stdout); 13 14 return e; 15 } 16 17 console.log('out: ', out.stdout, out.stderr); 18} 19 20run();
execSh(command, [options], [callback])
Execute shell command forwarding all stdio.
Parameters:
command {String|Array}
- The command to run, or array of commands[options] {Object|TRUE}
- Options object passed directly to child_process.spawn
, when TRUE
then { stdio: null }
used[callback] {Function}
- callback(err, stdout, stderr)
err {Error|NULL}
- Error object. Has code
property containing last command exit code when availablestdout {String|NULL}
- aggregated stdout or NULL
if not availablestderr {String|NULL}
- aggregated stderr or NULL
if not availableReturn Values:
Returns ChildProcess object.
Complete API Documentation including private and public methods is generated from source code by JSDoc tool and is available here.
Code coverage report for all files is available here.
npm test
- run testsnpm run jsdoc
- build jsdocnpm run dev
- run tests continuouslyThe MIT License (MIT)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
7 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More