Skip to content

Commit f5a1e6c

Browse files
TrottMylesBorins
authored andcommitted
test: fix flaky async-hooks/test-graph.signal
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]>
1 parent a333e71 commit f5a1e6c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/async-hooks/test-graph.signal.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
const common = require('../common');
44
if (common.isWindows) {
55
common.skip('no signals on Windows');
6-
return;
76
}
87

98
const initHooks = require('./init-hooks');
109
const verifyGraph = require('./verify-graph');
11-
const exec = require('child_process').exec;
10+
const { exec } = require('child_process');
1211

1312
const hooks = initHooks();
1413

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

1818
let count = 0;
@@ -33,7 +33,9 @@ function onsigusr2() {
3333
}
3434
}
3535

36-
function onsigusr2Again() {}
36+
function onsigusr2Again() {
37+
clearInterval(interval); // let the event loop close
38+
}
3739

3840
process.on('exit', onexit);
3941

0 commit comments

Comments
 (0)