Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
spawn-please
Advanced tools
The 'spawn-please' npm package is a utility that simplifies the process of spawning child processes in Node.js. It provides a promise-based interface for executing shell commands and capturing their output, making it easier to work with asynchronous code.
Execute a command
This feature allows you to execute a shell command and capture its output. The command 'ls' lists directory contents, and the output is logged to the console.
const spawnPlease = require('spawn-please');
spawnPlease('ls').then(output => {
console.log(output);
}).catch(err => {
console.error(err);
});
Execute a command with arguments
This feature allows you to execute a shell command with arguments. The command 'ls -l -a' lists directory contents in long format, including hidden files, and the output is logged to the console.
const spawnPlease = require('spawn-please');
spawnPlease('ls', ['-l', '-a']).then(output => {
console.log(output);
}).catch(err => {
console.error(err);
});
Execute a command with options
This feature allows you to execute a shell command with options. The command 'ls -l' lists directory contents in long format, and the 'cwd' option sets the current working directory to '/tmp'. The output is logged to the console.
const spawnPlease = require('spawn-please');
spawnPlease('ls', ['-l'], { cwd: '/tmp' }).then(output => {
console.log(output);
}).catch(err => {
console.error(err);
});
Execa is a higher-level alternative to Node's child_process module. It provides a promise-based interface for executing shell commands and capturing their output. Compared to 'spawn-please', Execa offers more features such as better error handling, support for streaming output, and more configuration options.
Child-process-promise is a simple wrapper around Node's child_process module that adds promise support. It allows you to execute shell commands and capture their output using promises. While it provides similar functionality to 'spawn-please', it is more lightweight and does not offer as many features.
Promisify-child-process is another package that adds promise support to Node's child_process module. It allows you to execute shell commands and capture their output using promises. It is similar to 'spawn-please' but focuses on providing a minimalistic and straightforward API.
Promisified child_process.spawn. *Supports stdin* *Rejects on stderr*
$ npm install --save spawn-please
promise = spawn(command, [arguments], [stdin], [options])
options
are passed directly through to child_process.spawn
.
const spawn = require('spawn-please')
spawn('printf', ['please?'])
.then(output => {
assert.equal(output, 'please?')
})
spawn('cat', [], 'test')
.then(output => {
assert.equal(output, 'test')
})
spawn('some-command-with-stderr')
.catch(stderr => {
// do something with stderr
})
spawn-please uses the global Promise object by default. You may use your own Promise library by overriding the Promise property:
const spawn = require('spawn-please')
spawn.Promise = require('bluebird')
ISC © Raine Revere
FAQs
Easy and small child_process.spawn
The npm package spawn-please receives a total of 179,939 weekly downloads. As such, spawn-please popularity was classified as popular.
We found that spawn-please demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.