From f9c30abcdce7530987c159396286847f20e3d4ef Mon Sep 17 00:00:00 2001 From: Paolo Insogna Date: Fri, 24 Jun 2022 11:30:30 +0200 Subject: [PATCH] benchmark: forcefully close processes PR-URL: https://github.com/nodejs/node/pull/43557 Fixes: https://github.com/nodejs/build/issues/2968 Reviewed-By: Ruben Bridgewater Reviewed-By: Rod Vagg Reviewed-By: Matteo Collina --- benchmark/common.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/benchmark/common.js b/benchmark/common.js index 88cb8a560f40e1..080cfc71785eec 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -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));