Giter Club home page Giter Club logo

fkill's Introduction


fkill


Fabulously kill processes. Cross-platform.

Works on macOS (10.13 or later), Linux, Windows.

Install

npm install fkill

Usage

import fkill from 'fkill';

await fkill(1337);
console.log('Killed process');

fkill('Safari');
fkill(':8080');

fkill([1337, 'Safari', ':8080']);

API

fkill(input, options?)

Returns a promise that resolves when the processes are killed.

input

Type: number | string | Array<number | string>

One or more process IDs/names/ports to kill.

To kill a port, prefix it with a colon. For example: :8080.

options

Type: object

force

Type: boolean
Default: false

Force kill the processes.

forceAfterTimeout

Type: number
Default: undefined

Force kill processes that did not exit within the given number of milliseconds.

tree

Type: boolean
Default: true

Kill all child processes along with the parent process. (Windows only)

ignoreCase

Type: boolean
Default: false

Ignore capitalization when killing a process.

Note that the case is always ignored on Windows.

silent

Type: boolean
Default: false

Suppress all error messages. For example: Process doesn't exist.

Related

fkill's People

Contributors

alextes avatar bendingbender avatar brandon93s avatar diegohaz avatar hafffe avatar kevva avatar medusalix avatar ntwb avatar samverschueren avatar sindresorhus avatar stroncium avatar turbo87 avatar yaodingyd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fkill's Issues

Killing the node process without killing fkill

Issuehunt badges

Currently, fkill does a simple pid filter using process.pid to ignore a request to kill itself. On Windows, fkill would also filter out its pid when killing all processes with the name node. Unfortunately, this meant Windows' taskkill always felt it succeeded, even when killing zero processes as a result.

PR #17 removed this feature. It makes fkill's behavior consistent, and also allows for tests to fail when fkill doesn't find an expected target on Windows (see #16).

That's the context. We don't want to kill ourselves when asked to kill node. That's what this issue is about.


IssueHunt Summary

yaodingyd yaodingyd has been rewarded.

Sponsors (Total: $40.00)

Tips

On macOS Sierra 10.12, `fkill --force` by process name throws exception because `pkill` does not support `-9` flag

$ fkill --force node
AggregateError: 
    Error: Killing process node failed: pkill: illegal option -- 9
    usage: pkill [-signal] [-ILfilnovx] [-F pidfile] [-G gid]
                 [-P ppid] [-U uid] [-g pgrp]
                 [-t tty] [-u euid] pattern ...
        at Array.map (<anonymous>)
        at processExists.all.then.then (/Users/ivanbabak/.nvm/versions/node/v8.7.0/lib/node_modules/fkill-cli/node_modules/fkill/index.js:83:10)
        at <anonymous>
    at processExists.all.then.then (/Users/ivanbabak/.nvm/versions/node/v8.7.0/lib/node_modules/fkill-cli/node_modules/fkill/index.js:83:10)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

fkill/index.js

Lines 16 to 23 in 23503ec

function macOSKill(input, opts) {
const killByName = typeof input === 'string';
const cmd = killByName ? 'pkill' : 'kill';
const args = [input];
if (opts.force) {
args.unshift('-9');
}

Invalid regular expression

Hi.
I have an issue.

\node_modules\ps-list\index.js:80
const psOutputRegex = /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>\d+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+/;
                      ^

SyntaxError: Invalid regular expression: /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>\d+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+/: Invalid group

Getting this when trying to execute basic script with fkill.

SIGINT support

Is it possible to support sending interruption signal to the process to make it graceful exit using this NPM package?
It should be equivalent to CTRL+C.

Is there any change to optimize the processing time?

Issuehunt badges

I need to kill the process tree in 5 seconds. However, I found that the code will run almost 10+ seconds before returned. Any suggestions? Thanks.

const fkill = require('fkill');
...
await fkill(pid, {"force": true, "tree": true}); // It takes longer than expected

There is a $8.00 open bounty on this issue. Add more on Issuehunt.

Adding an ignoreCase option

I started work on adding an ignoreCase option.
First of all, that was a fun trail down the chain to find out how fkill and its dependencies work. I quickly stopped searching the npm registry for them and searching Sindre's personal repo's instead 😄 .
Secondly: the fkill logo is beautiful. Had to be said.
Third: adding an ignoreCase option turns out to be a real pain.

Linux
Easy. Add '-I' flag. Done. Go Linux.

macOS and BSD
No ignore case option. The closest provided option is using a regular expression 😓 .
Both do however have pgrep and pkill, both of which, feature an ignore case option!

SunOS
What even is this 😂 ? Anyway not even a little bit of options

Windows
Zero options to ignore case, zero options to collect pid's with ignore case.

We could just issue two kill commands.. Far easier. Less correct.

Please let me loose on this :3 . If you say, far too much hassle for ignore case, don't want to complicate the code that bad, or take on an abstraction for it .. I totally understand.

Kill all (exact matches)

I currently have to run fkill about 5 times when I search for python. It would be nice if I could somehow request either:

  1. Kill all exact matches
  2. Kill all visible, suggested processes on my screen

Interested in a PR?

pkill: illegal option -- 9

It seems that the -f option isn't quite working for me:

$ fkill -f ember
AggregateError: 
    Error: Killing process ember failed: pkill: illegal option -- 9
    usage: pkill [-signal] [-ILfilnovx] [-F pidfile] [-G gid]
                 [-P ppid] [-U uid] [-g pgrp]
                 [-t tty] [-u euid] pattern ...
        at Array.map (<anonymous>)
        at fkill (/Users/tbieniek/.volta/tools/image/packages/fkill-cli/6.0.1/node_modules/fkill/index.js:124:9)
    at fkill (/Users/tbieniek/.volta/tools/image/packages/fkill-cli/6.0.1/node_modules/fkill/index.js:124:9)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

I'm running this on macOS 10.14 with the fish shell, in case it matters.

Make extension optional on Windows?

Issuehunt badges

Currently, you have to include the extension if you want to kill an application.

Eg. fkill('notepad.exe')

Would be nice if you just do fkill('notepad').

If the user did fkill('notepad'), it could first try killing notepad, then notepad.exe if that didn't work.

Would love some thoughts on this from Windows users.


IssueHunt Summary

Backers (Total: $62.00)

Submitted pull Requests


Become a backer now!

Or submit a pull request to get the deposits!

Tips

Cannot install on Zorin 16 (Ubuntu 20.04. 2 LTS)

I cannot install on Zorin. I try two commands: npm install fkill and npm install --global fkill-cli. I install nodejs and npm before.

npm install fkill
[..................] - rollbackFailedOptional: verb npm-session ed90483d122539e
npm WARN saveError ENOENT: no such file or directory, open '/home/emi/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN enoent ENOENT: no such file or directory, open '/home/emi/package.json'
npm WARN emi No description
npm WARN emi No repository field.
npm WARN emi No README data
npm WARN emi No license field.

+ [email protected]
added 27 packages from 7 contributors and audited 27 packages in 6.123s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

emi@emilka-matebook:~$ 
emi@emilka-matebook:~$ fkill

Polecenie 'fkill' nie zostało znalezione, ale można je zainstalować za pomocą:

sudo snap install fkill

emi@emilka-matebook:~$ sudo npm install fkill
npm WARN saveError ENOENT: no such file or directory, open '/home/emi/package.json'
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN enoent ENOENT: no such file or directory, open '/home/emi/package.json'
npm WARN emi No description
npm WARN emi No repository field.
npm WARN emi No README data
npm WARN emi No license field.

+ [email protected]
updated 1 package and audited 48 packages in 0.856s

14 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

emi@emilka-matebook:~$ npm install --global fkill-cli
npm WARN checkPermissions Missing write access to /usr/local/lib
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/emi/.npm/_logs/2021-12-05T08_55_44_196Z-debug.log
emi@emilka-matebook:~$ sudo npm install --global fkill-cli
/usr/local/bin/fkill -> /usr/local/lib/node_modules/fkill-cli/cli.js
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

+ [email protected]
added 153 packages from 100 contributors in 12.696s
emi@emilka-matebook:~$ fkill
/usr/local/lib/node_modules/fkill-cli/cli.js:2
import process from 'node:process';
       ^^^^^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Regards.

Mac ignoreCase causes error

Using the option "ignoreCase" set to true on a Mac (10.15.6) results in an error

usage: fkill('flask_app', {force:true, ignoreCase:true, silent:false});

error:
(node:47333) UnhandledPromiseRejectionWarning: AggregateError:
Error: Killing process flask_app failed: pkill: illegal option -- K
usage: pkill [-signal] [-ILfilnovx] [-F pidfile] [-G gid]
[-P ppid] [-U uid] [-g pgrp]
[-t tty] [-u euid] pattern ...
at Array.map ()

Whereas leaving that option out does not cause an error.
ie.
fkill('flask_app', {force:true, silent:false});

Don't force kill by default

Yup, ironic, seeing how the name is about that, but I got strong feedback from Unix people that force killing by default is super wrong. Instead, I guess we could have a force option that defaults to false. Same for the CLI.

Note to self: Need to come up with a new tagline and meaning for the f in fkill...

CommonJS support - include index.cjs

Hello, since you are now using native esm modules, it is not possible to install this library in any commonjs projects using typescript.

As far as i know, you have to include an index.cjs in order for it to work on legacy commonjs projects

Add Ethereum name or address to package.json

I would like to see an Ethereum name or address added to the ethereum field of the package.json file. This will allow consumers of the project to know a cannonical address to send funds to. For example, I'm building an application that will allow developers to automatically donate ETH to all of their npm dependencies that have Ethereum addresses in their package.json files: https://sustainus.io

Global install

Absolutely love fkill. Use it all the time.

I understand the reasons behind making a seperate fkill-cli repo for CLI - but it means that is not as smooth to type.

Would you be willing to accept a PR adding a bin named fkill pointing to basically what would be the content of https://github.com/sindresorhus/fkill-cli/blob/main/cli.js but using to the local version of the fkill code?

so you could do a npx fkill :8080 instead of having to remember the -cli.

I know, I know - it might seem silly, but fkill is kind of those commands that just sits in the fingers.

Don't fail fast

Currently, if one child process fails, it finishes. This can make it hard for the user to know which failed and not. It should wait until all are complete, gather up all the errors and display them at the end.

Windows - fkill error if process started with /min flag

"fkill": "^7.0.1"

spawn(`cmd`, ['/C', 'start /min altv-server.exe'], { detached: true, stdio: 'inherit' });

Error:

AggregateError: 
    Error: Killing process altv-server.exe failed: Command failed with exit code 128: taskkill /t /im altv-server.exe
        at Array.map (<anonymous>)
        at fkill (D:/server/node_modules/fkill/index.js:128:9)
        at runMicrotasks (<anonymous>)
    at fkill (D:\server\node_modules\fkill\index.js:128:9)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
...

Actually windows throws the error: taskkill /t /im altv-server.exe

ERROR: The process with PID 5684 (child process of PID 22572) could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).

Unexpected behavior because of pkill on macOS

For macosKill, the killByName option uses pkill instead of killall.

This causes unexpected behavior, because pkill kills all processes matching a pattern instead of an exact process string match.

For example, calling fkill('something') on macOS will kill something processes, but also something-else, not-something, etc. as a standard string "pattern" is actually a substring match.

Kill tree (all sub-processes)

Issuehunt badges

Typical use case is starting a process with multiple sub-processes and then wanting to killing them all:

const child = require('child_process').exec("node -e 'while (true);'");
child.kill(); // will not work

It's been implemented for Windows in #20, would be nice to have this functionality cross-platform.

There is a $40.00 open bounty on this issue. Add more on Issuehunt.

Cannot find module node:process

Hey I have a express app that runs on :6001 when window_open listener triggers in a electron application. How can i solve for this error?

NodeProcess Error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.