Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill process with node js

Im running BDD tests that uses IE, chrome and firefox drivers. Sometimes when my tests fails it doesnt kills the drivers so it keeps running. I want to kill all the process with the process name, something like this in windows

taskkill /F /IM chromedriver.exe /T

but with node js or something that will work along in linux and windows machines. If its with some gulp plugin would be great so I can add it as a task.

like image 270
Frankusky Avatar asked Mar 04 '26 10:03

Frankusky


1 Answers

You are looking for something like fkill

Works on macOS, Linux, Windows.

usage examples :

const fkill = require('fkill');

fkill(1337).then(() => {
    console.log('Killed process');
});

fkill('Safari');

fkill([1337, 'Safari']);
like image 148
EMX Avatar answered Mar 06 '26 02:03

EMX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!