Skip to content

Commit

Permalink
process: properly close file descriptor on exit
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
BridgeAR authored and rvagg committed Feb 28, 2019
1 parent 38724f6 commit e75e1bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/process/warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
};
}

Expand Down

0 comments on commit e75e1bc

Please sign in to comment.