Skip to content

Commit

Permalink
benchmark: fix output regression
Browse files Browse the repository at this point in the history
Fixes: nodejs/node#43628

PR-URL: nodejs/node#43635
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
mscdex authored and guangwong committed Oct 10, 2022
1 parent 7dccbb6 commit e1da0ac
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e1da0ac

Please sign in to comment.