Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of floating number for the timeout and forceKillAfterTimeout options #431

Merged
merged 7 commits into from Jul 6, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/kill.js
Expand Up @@ -44,7 +44,7 @@ const getForceKillAfterTimeout = ({forceKillAfterTimeout = true}) => {
return DEFAULT_FORCE_KILL_TIMEOUT;
}

if (!Number.isInteger(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
}

Expand All @@ -71,7 +71,7 @@ const setupTimeout = (spawned, {timeout, killSignal = 'SIGTERM'}, spawnedPromise
return spawnedPromise;
}

if (!Number.isInteger(timeout) || timeout < 0) {
if (!Number.isFinite(number) || timeout < 0) {
Kikobeats marked this conversation as resolved.
Show resolved Hide resolved
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
}

Expand Down