Files
node/test/parallel/test-child-process-fork-advanced-header-serialization.js
T
Antoine du Hamel f951acf624 test: remove unnecessary process.exit calls from test files
PR-URL: https://github.com/nodejs/node/pull/62020
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-03-01 11:33:00 +00:00

41 lines
862 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const { fork } = require('child_process');
const fs = require('fs');
if (process.argv[2] === 'child-buffer') {
const v = process.argv[3];
const payload = Buffer.from([
(v >> 24) & 0xFF,
(v >> 16) & 0xFF,
(v >> 8) & 0xFF,
v & 0xFF,
]);
const fd = process.channel?.fd;
if (fd !== undefined) {
fs.writeSync(fd, payload);
}
return;
}
const testCases = [
0x00000001,
0x7fffffff,
0x80000000,
0x80000001,
0xffffffff,
];
for (const size of testCases) {
const child = fork(__filename, ['child-buffer', size], {
serialization: 'advanced',
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
});
child.on('exit', common.mustCall((code, signal) => {
assert.strictEqual(code, 0);
assert.strictEqual(signal, null);
}));
}