From e1da0ac6c6e0f0be1041a13cfb53e676fcb0b2e7 Mon Sep 17 00:00:00 2001 From: Brian White Date: Thu, 30 Jun 2022 17:43:34 -0400 Subject: [PATCH] benchmark: fix output regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/nodejs/node/issues/43628 PR-URL: https://github.com/nodejs/node/pull/43635 Reviewed-By: Paolo Insogna Reviewed-By: Rich Trott Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: Chengzhong Wu --- benchmark/common.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/benchmark/common.js b/benchmark/common.js index e582dc8bdc2..6ed230ffde4 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -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