From 41e57971117609d3cd985a4e60e87253fcf04b6c Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater 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. --- 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 {} }; }