nodejs/test/parallel/test-disable-sigusr1.js
Rafael Gonzaga 496e17e302
src: add --disable-sigusr1 to prevent signal i/o thread
This commit adds a new flag `--disable-sigusr1` to prevent
the SignalIOThread to be up listening the SIGUSR1 events and
then starting the debugging session.

PR-URL: https://github.com/nodejs/node/pull/56441
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-01-13 16:51:34 +00:00

27 lines
896 B
JavaScript

'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
const { it } = require('node:test');
const assert = require('node:assert');
const { NodeInstance } = require('../common/inspector-helper.js');
common.skipIfInspectorDisabled();
it('should not attach a debugger with SIGUSR1', { skip: common.isWindows }, async () => {
const file = fixtures.path('disable-signal/sigusr1.js');
const instance = new NodeInstance(['--disable-sigusr1'], undefined, file);
instance.on('stderr', common.mustNotCall());
const loggedPid = await new Promise((resolve) => {
instance.on('stdout', (data) => {
const matches = data.match(/pid is (\d+)/);
if (matches) resolve(Number(matches[1]));
});
});
assert.ok(process.kill(instance.pid, 'SIGUSR1'));
assert.strictEqual(loggedPid, instance.pid);
assert.ok(await instance.kill());
});