Skip to content

Commit

Permalink
fix the isNaN sanitizer in kill(..).
Browse files Browse the repository at this point in the history
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 fix is simply to remove the `typeof`.
  • Loading branch information
erik-krogh authored Feb 7, 2022
1 parent a379d31 commit 5a2b38d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
throw new Error('PID is required for the kill operation.');
}

if (typeof isNaN(pid)) {
if (isNaN(pid)) {
throw new Error('PID must be a number.')
}

Expand Down Expand Up @@ -86,4 +86,4 @@ module.exports = {
});
}

};
};

0 comments on commit 5a2b38d

Please sign in to comment.