Skip to content

Commit

Permalink
benchmark: forcefully close processes
Browse files Browse the repository at this point in the history
PR-URL: #43557
Fixes: nodejs/build#2968
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
ShogunPanda authored and targos committed Jul 12, 2022
1 parent 4df96b5 commit f9c30ab
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);
}, 5000).unref();
});
} else {
// Otherwise report by stdout
process.stdout.write(formatResult(data));
Expand Down

0 comments on commit f9c30ab

Please sign in to comment.