+1
-1
| { | ||
| "name": "call-bash", | ||
| "version": "1.18.0", | ||
| "version": "1.19.0", | ||
| "description": "Execute bash commands with non-blocking I/O.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+13
-13
@@ -54,19 +54,17 @@ # call-bash | ||
| The package simply wraps the `child_process.spawn` call in a Promise which is resolved on exit and rejected on error. | ||
| The package simply wraps the `child_process.spawn` call in a Promise which is | ||
| resolved on exit and rejected on error. Multiple commands may be passed in, and | ||
| they will be executed in sequential order. | ||
| `index.js` | ||
| ```javascript | ||
| const call = (cmd, options = DEFAULTS) => new Promise( | ||
| (resolve, reject) => { | ||
| const callBash = async (...cmds) => { | ||
| for (let cmd of cmds) { | ||
| cmd = cmd.split(' '); | ||
| spawn(cmd.shift(), cmd, options) | ||
| .on('exit', resolve) | ||
| .on('error', reject); | ||
| await new Promise((resolve, reject) => { | ||
| spawn(cmd.shift(), cmd, STDIO) | ||
| .on('exit', resolve) | ||
| .on('error', reject); | ||
| }); | ||
| } | ||
| ); | ||
| const sequential = async (cmds, options) => { | ||
| for (const cmd of cmds) { | ||
| await call(cmd, options); | ||
| } | ||
| } | ||
@@ -77,2 +75,4 @@ ``` | ||
| By default, the options `{ stdio: 'inherit' }` are passed, largely so stdout is visible. These can be overridden in the second argument to either `call` or `sequential`. | ||
| The options `{ stdio: 'inherit' }` are passed to `spawn`, so stdout will be | ||
| visible. This is not configurable for the sake of simplicity (the only | ||
| arguments) `callBash` takes are commands). |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
4218
0.88%