Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
spawn-error-forwarder
Advanced tools
Emit errors on stdout stream for a spawned child process. Useful for capturing errors from a spawned process when you want the output from stdout.
$ npm install spawn-error-forwarder
fwd(child [, errFactory]
-> child
Buffers child.stderr
output. If the spawned process exits with a code > 0
, the buffered output of child.stderr
is used to generate an error which is emitted on child.stdout
. By default, the error message is the output of child.stderr
. If you provide an errFactory
function, it will be called with code, stderr
where code
is the child's exit code and stderr
is string that contains the output of child.stderr
. errFactory
should return an Error
to be emitted on child.stdout
.
var fwd = require('spawn-error-forwarder');
var spawn = require('child_process').spawn;
var child = spawn('git', ['log', 'non-existent-path']);
fwd(child, function (code, stderr) {
return new Error('git log exited with ' + code + ':\n\n' + stderr);
});
child.stdout
.on('error', console.error.bind(console))
.pipe(process.stdout);
We want to pipe the output of git log
to process.stdout
but since we're providing a path that doesn't exist git will exit with a non-zero code and we'll log its output with console.error
.
FAQs
Emit errors on stdout stream for a spawned child process
The npm package spawn-error-forwarder receives a total of 928,070 weekly downloads. As such, spawn-error-forwarder popularity was classified as popular.
We found that spawn-error-forwarder 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.