Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fkill = async (inputs, options = {}) => {
inputs = arrify(inputs)
options.tree = options.tree === undefined ? true : options.tree
options.ignoreCase = options.ignoreCase || process.platform === 'win32'
const exists = await processExists.all(inputs)
const errors = []
const handleKill = async input => {
try {
input = await parseInput(input)
if (input === process.pid) {
return
}
// Handle killall by process name
if (typeof input === 'string') {
const processes = await psList()
const nameRe = new RegExp(`^${input}$`, options.ignoreCase ? 'i' : '')
const fkill = async (inputs, options = {}) => {
inputs = arrify(inputs);
const exists = await processExists.all(inputs);
const errors = [];
const handleKill = async input => {
try {
input = await parseInput(input);
if (input === process.pid) {
return;
}
if (input === 'node') {
const processes = await psList();
await Promise.all(processes.map(async ps => {
if (ps.name === 'node' && ps.pid !== process.pid) {
await kill(ps.pid, options);