mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Ignore `PostDelayedTask` after `Stop` to avoid assertions. Fixes: https://github.com/nodejs/node/issues/56645 Signed-off-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> PR-URL: https://github.com/nodejs/node/pull/61999 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Aviv Keller <me@aviv.sh>
33 lines
785 B
JavaScript
33 lines
785 B
JavaScript
'use strict';
|
|
// Ref: https://github.com/nodejs/node/issues/56645
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
const http = require('http');
|
|
|
|
if (process.argv[2] === 'child') {
|
|
http
|
|
.createServer((_, res) => {
|
|
res.writeHead(302, { Location: '/' });
|
|
res.end();
|
|
})
|
|
.listen(0, '127.0.0.1', async function() {
|
|
try {
|
|
await fetch(`http://127.0.0.1:${this.address().port}/`);
|
|
} catch {
|
|
// ignore
|
|
}
|
|
process.exit(0);
|
|
});
|
|
} else {
|
|
const child = cp.spawn(process.execPath, [__filename, 'child']);
|
|
|
|
child.on(
|
|
'close',
|
|
common.mustCall((exitCode, signal) => {
|
|
assert.strictEqual(exitCode, 0);
|
|
assert.strictEqual(signal, null);
|
|
}),
|
|
);
|
|
}
|