Skip to content

Commit

Permalink
benchmark: forcefully close processes
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Jun 27, 2022
1 parent 4ecc6a4 commit fe5dc88
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,13 @@ function formatResult(data) {
function sendResult(data) {
if (process.send) {
// If forked, report by process send
process.send(data);
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);
}, 1000).unref();
});
} else {
// Otherwise report by stdout
process.stdout.write(formatResult(data));
Expand Down

0 comments on commit fe5dc88

Please sign in to comment.