Skip to content

Commit

Permalink
benchmark: forcefully close processes
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#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 guangwong committed Oct 10, 2022
1 parent 9c0037c commit a3407c1
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 a3407c1

Please sign in to comment.