Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
benchmark: forcefully close processes
  • Loading branch information
ShogunPanda committed Jun 27, 2022
commit fe5dc88b71817aeb0ee34462b77ac2b359c49fb2
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