Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

call-bash

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

call-bash - npm Package Compare versions

Comparing version 1.18.0 to 1.19.0

2

package.json
{
"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",

@@ -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).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc