sindresorhus / fkill-cli

Fabulously kill processes. Cross-platform.
MIT License
6.88k stars 159 forks source link

Forcefull termination #11

Closed sparty02 closed 7 years ago

sparty02 commented 7 years ago

I just tried out fkill and the first process I tried to kill resulted in an error... :smiley_cat: In this particular case, I was trying to kill a process that apparently needed to be "terminated forcefully" (see the output below). Maybe in these cases, fkill presents a secondary challenge to the terminal like "Are you sure you want to kill this process?" and then forcefully terminate upon yes, or cancel upon no. Or maybe you don't want to allow the ability to forcefully terminate, in which a friendlier error message would probably suffice.

Just wanted to highlight the issue!

P.S. for what its worth, I'm on Windows 7, currently using a git-bash flavored shell, node 6.2.1.

$ fkill
? Running processes: cnt
? Running processes: cntlm.exe 2200

AggregateError:
    Error: Killing process 2200 failed: ERROR: The process with PID 2200 could not be terminated.
    Reason: This process can only be terminated forcefully (with /F option).
        at Promise.all.then (C:/Users/********/AppData/Roaming/nvm/v6.2.1/node_modules/fkill-cli/node_modules/fkill/index.js:41:10)
    at AggregateError (C:\Users\********\AppData\Roaming\nvm\v6.2.1\node_modules\fkill-cli\node_modules\aggregate-error\index.js:19:3)
    at Promise.all.then (C:\Users\********\AppData\Roaming\nvm\v6.2.1\node_modules\fkill-cli\node_modules\fkill\index.js:41:10)
    at process._tickCallback (internal/process/next_tick.js:103:7)
sindresorhus commented 7 years ago

Yes, would be nice to detect this case and present and interactive prompt of whether you want to force kill it or just exit. Pull request welcome :)

sparty02 commented 7 years ago

"Error killing process. Would you like to use the force?" beautiful! Thanks!