Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@figliolia/child-process
Advanced tools
A wrapper around the node.js spawn function providing a promise and graceful exiting
Readme
A small wrapper around the Node.js ChildProcess.spawn
function that provides access to not only the child process, but a wrapping promise to use in your JavaScript logic.
npm install --save @figliolia/child-process
# or
yarn add @figliolia/child-process
import { ChildProcess } from "@figliolia/child-process";
const CP = new ChildProcess(
"some shell command"
);
// Await the completion of your command
await CP.handler;
// Use the raw child process in your code
CP.process.on("something", () => {});
// If you do not need access to the underlying child process,
// but instead wish to have just a promise with stdio access
const { stdout, stderr } = await ChildProcess.execute("your command");
It's fairly common to require the management of multiple sub-process when building complex applications such as development environments, CI's, and more.
This library provides a means for handling multiple child processes as well as binding to kill exit signals that may cause an underlying application to fail.
import { ChildProcess } from "@figliolia/child-process";
class MyApplication {
public static run() {
const shells = this.bootStuffUp();
// Kill each shell if the parent process receives
// a kill signal or uncaught exception
ChildProcess.bindExits(shells);
// Await the completion of all commands
return Promise.all(shells.map(CP => CP.handler));
}
private static bootStuffUp() {
return [
new ChildProcess(
"some shell command"
),
new ChildProcess(
"another shell command"
),
new ChildProcess(
"perhaps another shell command"
),
]
}
}
FAQs
A wrapper around the node.js spawn function providing a promise and graceful exiting
We found that @figliolia/child-process demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).