
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Simpler way to handle spawning processes in NodeJs
var Nodeproc = require('nodeproc');
var processes = new Nodeproc();
// Most basic use
processes.spawn('npm ls').then(function(results) {
console.log('Finished');
console.log('Process ID: ', results.procId);
console.log('Exit code: ', results.exitCode);
});
// Slightly more complicated
processes.spawn({
command: 'npm',
args: ['ls'],
cwd: '/home/joe' // Specify where the command should be run from
}).then(function() {
console.log('Finished');
});
// Control stdout and/or stderr from the process.
// These can be anything that supports the write(data, encoding) method.
// These default to process.stdout and process.stderr respectively
var captureStdout = {
write: function(data, encoding) {
console.log('Got data: ', data.toString(encoding));
}
};
processes.spawn({
command: 'npm',
args: 'ls' // Can either be an array or a space-delimited string
stdout: captureStdout
}).then(funnction() {
console.log('Finished');
});
// Catch errors using a Promise catch function
processes.spawn({
command: 'npm',
args: ['doesnotexit'],
ignoreExitCode: true
}).catch(function(err) {
console.log('Got error! ', err);
console.log('Process ID: ', err.procId);
console.log('Exit code: ', err.exitCode);
console.log('Stderr: ', err.stderr);
});
// Can ignore error exit status codes, and always resolve the process
processes.spawn({
command: 'npm',
args: ['doesnotexit'],
ignoreExitStatusCode: true
}).then(function() {
console.log('Finished');
});
See the tests for more examples
FAQs
Simpler handling of spawning processes
The npm package nodeproc receives a total of 0 weekly downloads. As such, nodeproc popularity was classified as not popular.
We found that nodeproc 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.