Skip to content

Commit

Permalink
🆕 Allow specifying Infinity to ignore exec timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
steelbrain committed Feb 23, 2016
1 parent 9998b39 commit e42426d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ export async function exec(
try {
spawnedProcess.process.stdin.end()
} catch (_) { /* No Op */ }
timeout = setTimeout(function () {
try {
spawnedProcess.kill()
} catch (_) { /* No Op */ }
reject(new Error('Process execution timed out'))
}, options.timeout)
if (options.timeout !== Infinity) {
timeout = setTimeout(function () {
try {
spawnedProcess.kill()
} catch (_) { /* No Op */ }
reject(new Error('Process execution timed out'))
}, options.timeout)
}
})
}

0 comments on commit e42426d

Please sign in to comment.