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

test: fix flaky test-trace-sigint-on-idle #31645

Closed
Closed
Changes from all 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
12 changes: 7 additions & 5 deletions test/pseudo-tty/test-trace-sigint-on-idle.js
@@ -1,6 +1,5 @@
'use strict';

const { mustCall } = require('../common');
const { platformTimeout, mustCall } = require('../common');
const childProcess = require('child_process');
const assert = require('assert');

Expand All @@ -14,9 +13,11 @@ if (process.env.CHILD === 'true') {
['--trace-sigint', __filename],
{
env: { ...process.env, CHILD: 'true' },
stdio: 'inherit'
stdio: ['inherit', 'inherit', 'inherit', 'ipc']
});
setTimeout(() => cp.kill('SIGINT'), 1 * 1000);
cp.on('message', mustCall(() => {
setTimeout(() => cp.kill('SIGINT'), platformTimeout(100));
}));
cp.on('exit', mustCall((code, signal) => {
assert.strictEqual(signal, 'SIGINT');
assert.strictEqual(code, null);
Expand All @@ -26,5 +27,6 @@ if (process.env.CHILD === 'true') {
function main() {
// Deactivate colors even if the tty does support colors.
process.env.NODE_DISABLE_COLORS = '1';
setTimeout(() => {}, 10 * 1000);
process.channel.ref(); // Keep event loop alive until the signal is received.
process.send('ready');
}