-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
harden v8flags for people with jacked up environment variables #15
Conversation
a3d56b0
to
512dbd1
Compare
@tkellen could a lot of this logic be handled by a library like https://github.com/bruce/node-temp ?? |
Doesn't seem like it, it relies on |
@tkellen okay, but these are kind of config files, why don't we use a module that stores config files in the user's home directory instead? |
That's a fantastic idea. Do you know of any widely used and reliable modules for that? |
https://www.npmjs.com/package/configstore is what yeoman uses |
derp, that uses yml files, could probably just use https://www.npmjs.com/package/xdg-basedir to get the config directory |
Well, unless anyone has any objections, I'm going to publish this and see if it does any better. |
(I've updated it to use |
let me review, didn't see the update |
Roger. Just updated the error message. |
// to write to it. | ||
function openConfig (cb) { | ||
var userHome = require('user-home'); | ||
var dir = '/cow'+path.join(userHome || os.tmpdir(), configfile); |
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.
why /cow
?
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.
heh, was testing the failure condition while updating the error message. removed.
f4b9de8
to
af4f80e
Compare
function openConfig (cb) { | ||
var userHome = require('user-home'); | ||
var dir = path.join(userHome || os.tmpdir(), configfile); | ||
fs.open(dir, 'a+', function (firstOpenErr, firstFd) { |
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.
are you sure you want to append? If that file is already there, we could end with invalid json
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.
not going to append, but i need it to throw if the file isn't there, i can't use w+
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.
Hmm, need to double check this makes any sense, actually. Thanks.
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.
Okay yeah, this is fine. If the file has a size larger than 0 it will never be written to.
d95e583
to
5fc7dc1
Compare
would love some feedback on this mess if you have time @contra @phated @sindresorhus.
basically, this tries to deal with fucked up environments where a temp directory cannot be found using
os.tmpdir()
, which is (sadly) not all that uncommon. i hate this module.