From f43f45a26cd0fe222d52c96a9df6df8b797b997f Mon Sep 17 00:00:00 2001
From: Ruben Bridgewater <ruben@bridgewater.de>
Date: Tue, 11 Dec 2018 23:22:20 +0100
Subject: [PATCH] process: properly close file descriptor on exit

This makes sure the file descriptor is closed syncronously on exit
instead of using the asyncronous version which should not be used
on exit.

PR-URL: https://github.com/nodejs/node/pull/24972
Refs: https://github.com/nodejs/node/pull/24965/files#r240770314
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
---
 lib/internal/process/warning.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/internal/process/warning.js b/lib/internal/process/warning.js
index 2238bc2577bb50..6635f7b9b1dda0 100644
--- a/lib/internal/process/warning.js
+++ b/lib/internal/process/warning.js
@@ -22,7 +22,9 @@ function writeOut(message) {
 function onClose(fd) {
   return () => {
     if (fs === null) fs = require('fs');
-    fs.close(fd, nop);
+    try {
+      fs.closeSync(fd);
+    } catch {}
   };
 }