benchmark: fix output regression

Fixes: https://github.com/nodejs/node/issues/43628

PR-URL: https://github.com/nodejs/node/pull/43635
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Brian White 2022-06-30 17:43:34 -04:00 committed by Paolo Insogna
parent a1653ac715
commit adef64ce63

View File

@ -287,14 +287,16 @@ function formatResult(data) {
}
function sendResult(data) {
if (process.send && Object.hasOwn(process.env, 'NODE_RUN_BENCHMARK_FN')) {
if (process.send) {
// If forked, report by process send
process.send(data, () => {
// If, for any reason, the process is unable to self close within
// a second after completing, forcefully close it.
setTimeout(() => {
process.exit(0);
}, 5000).unref();
if (Object.hasOwn(process.env, 'NODE_RUN_BENCHMARK_FN')) {
// If, for any reason, the process is unable to self close within
// a second after completing, forcefully close it.
setTimeout(() => {
process.exit(0);
}, 5000).unref();
}
});
} else {
// Otherwise report by stdout