-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: move nullCheck to internal/fs.js to dedupe #8292
Conversation
@@ -6,6 +6,7 @@ | |||
const constants = process.binding('constants').fs; | |||
const util = require('util'); | |||
const pathModule = require('path'); | |||
const internalFs = require('internal/fs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff in this file could be a lot smaller if you add const nullCheck = internalFs.nullCheck;
up here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would, until the next few things are extracted and we get a refactor doing this same thing. Do we have precedent on this with internal? I'm not a fan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow on the problem. As for a precedent, I'm sure it goes both ways, but as an example -
Lines 12 to 17 in a6d53c6
const child_process = require('internal/child_process'); | |
const errnoException = util._errnoException; | |
const _validateStdio = child_process._validateStdio; | |
const setupChannel = child_process.setupChannel; | |
const ChildProcess = exports.ChildProcess = child_process.ChildProcess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rvagg ... I believe the suggestion is to do:
const internalFs = require('internal/fs');
const nullCheck = internalFs.nullCheck;
Which seems reasonable to me :-)
The last commit LGTM, with one comment. |
Changes to node_file.cc don't LGTM, see #8277 (comment). |
I think the first commits here are directly from #8277 and don’t require review (here). |
@@ -2,56 +2,74 @@ | |||
var common = require('../common'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be updated to const
since you're in here
c133999
to
83c7a88
Compare
ping @rvagg |
ping @rvagg |
This seems to have been superseded by ffed7b6. If this actually fixes something else as well, please reopen! |
Follows up on #8277 by deduping
nullCheck()
that's used in both fs.js and module.js by introducing internal/fs.js. Blocked by #6413, hence the separate PR. #8277 is intended to be backported to v4.x and v6.x, this PR can live on top of wherever #6413 lives.See HEAD commit on this branch for what I'm submitting in this PR, the other two belong in #8277.