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: nodejs#24972
Refs: https://github.com/nodejs/node/pull/24965/files#r240770314
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
BridgeAR authored and Trott committed Dec 14, 2018
1 parent 49f1db4 commit 80ab537
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 @@ -29,7 +29,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 80ab537

Please sign in to comment.