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 BethGriggs committed Feb 12, 2019
1 parent 944e75d commit a4068d9
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 a4068d9

Please sign in to comment.