Skip to content

Commit

Permalink
pass through timeout value
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 10, 2019
1 parent f60b861 commit e8428e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/package-manager/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ async function test(packageManager, context) {
);

const proc = spawn(bin, args, options);
const finish = timeout(context, proc, runScript, 'Test');
const finish = timeout(
context,
proc,
runScript,
'Test',
context.module.timeoutLength
);

proc.stdout.on('data', (data) => {
context.testOutput.append(data);
Expand Down
5 changes: 3 additions & 2 deletions lib/timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// Default timeout to 10 minutes if not provided
const kDefaultTimeout = 1000 * 60 * 10;

function timeout(context, proc, next, step) {
function timeout(context, proc, next, step, moduleConfigTimeout) {
let hasRun = false;
const delay = context.options.timeoutLength || kDefaultTimeout;
const delay =
context.options.timeoutLength || moduleConfigTimeout || kDefaultTimeout;
// Third arg === `true` is the way to signal `finish` that this is a timeout.
// Otherwise it acts like a "regular" callback, i.e. `(err, ret) => {}`.
// `if (timedOut)` will overwrite `err` & `ret`, so first 2 args are ignored.
Expand Down

0 comments on commit e8428e8

Please sign in to comment.