-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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: mkdtemp should not fail if no callback passed #6828
Conversation
8235c32
to
66a5666
Compare
LGTM. On an unrelated note, how about moving the |
LGTM if CI is green |
49a7016
to
b50654d
Compare
@mscdex I moved them and changed |
@thefourtheye Looks better now. However you might make the code move a separate commit so that the callback change is more easily visible. |
b50654d
to
0a87d37
Compare
@mscdex Oh yes. This is better now. Thanks :-) PTAL. |
@@ -2000,7 +2000,8 @@ SyncWriteStream.prototype.destroy = function() { | |||
|
|||
SyncWriteStream.prototype.destroySoon = SyncWriteStream.prototype.destroy; | |||
|
|||
fs.mkdtemp = function(prefix, options, callback) { | |||
fs.mkdtemp = function(prefix, options, callback_) { | |||
let callback = maybeCallback(callback_); |
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.
minor nit: might change this to var callback
to be consistent with the rest of fs
. Also let
in general is still slow IIRC, although whether that will matter in the grand scheme of things in this particular case is hard to say.
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.
@mscdex Sorry, I made a big mess out of this small change. PTAL now. I updated.
As it is, `fs.mkdtemp` crashes with a C++ assertion if the callback function is not passed. This patch uses `maybeCallback` to create one, if no callback function is passed.
0a87d37
to
daa3750
Compare
CI again just to be safe: https://ci.nodejs.org/job/node-test-pull-request/2690/ |
As it is, `fs.mkdtemp` crashes with a C++ assertion if the callback function is not passed. This patch uses `maybeCallback` to create one, if no callback function is passed. PR-URL: #6828 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #6828 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
As it is, `fs.mkdtemp` crashes with a C++ assertion if the callback function is not passed. This patch uses `maybeCallback` to create one, if no callback function is passed. PR-URL: #6828 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #6828 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
As it is, `fs.mkdtemp` crashes with a C++ assertion if the callback function is not passed. This patch uses `maybeCallback` to create one, if no callback function is passed. PR-URL: #6828 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #6828 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]>
Checklist
Affected core subsystem(s)
fs
Description of change
As it is,
fs.mkdtemp
crashes with a C++ assertion if the callbackfunction is not passed. This patch uses
maybeCallback
to create one,if no callback function is passed.