Skip to content

Commit

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

PR-URL: #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>
  • Loading branch information
mscdex authored and targos committed Jul 20, 2022
1 parent 40e1795 commit 6269549
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 6269549

Please sign in to comment.