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
isNaN(..)
method returns a boolean, therefore the result of thetypeof 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 anPID must be a number.
exception.The fix is simply to remove the
typeof
.