Skip to content

Commit

Permalink
test: fix flaky async-hooks/test-graph.signal
Browse files Browse the repository at this point in the history
Make sure event loop remains open long enough for signal to be received.

PR-URL: #17509
Fixes: #14568
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Dec 12, 2017
1 parent a333e71 commit f5a1e6c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/async-hooks/test-graph.signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
const common = require('../common');
if (common.isWindows) {
common.skip('no signals on Windows');
return;
}

const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');
const exec = require('child_process').exec;
const { exec } = require('child_process');

const hooks = initHooks();

hooks.enable();
const interval = setInterval(() => {}, 9999); // keep event loop open
process.on('SIGUSR2', common.mustCall(onsigusr2, 2));

let count = 0;
Expand All @@ -33,7 +33,9 @@ function onsigusr2() {
}
}

function onsigusr2Again() {}
function onsigusr2Again() {
clearInterval(interval); // let the event loop close
}

process.on('exit', onexit);

Expand Down

0 comments on commit f5a1e6c

Please sign in to comment.