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 <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
BridgeAR authored and refack committed Jan 10, 2019
1 parent 4a14223 commit e5fd8ee
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 e5fd8ee

Please sign in to comment.