coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.83k stars 356 forks source link

fix the `isNaN` sanitizer in `kill(..)`. #304

Closed erik-krogh closed 2 years ago

erik-krogh commented 2 years ago

The isNaN(..) method returns a boolean, therefore the result of the typeof isNaN(pid) expression will always be "boolean", therefore the condition in the if-statement is always truthy.

The result is that all calls to kill will throw an PID must be a number. exception.

The fix is simply to remove the typeof.

coreybutler commented 2 years ago

Strange, I don't remember writing that code, but you're right. Thanks for the fix!

MrFiregore commented 2 years ago

this code is not implemented in the npm package yet