-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: make F_OK/R_OK/W_OK/X_OK not writable #507
Conversation
a description would be nice with pull requests to help justify the change also, it looks like this might break because |
df8e11e
to
b6edf73
Compare
Updated. @rvagg . |
thanks, will leave this open for comment for now |
Why not apply this to any of the other constants in |
Other constants in |
Use const instead of var will be better. |
|
fs.R_OK = R_OK; | ||
fs.W_OK = W_OK; | ||
fs.X_OK = X_OK; | ||
// don't allow mode to accidentally be overwritten. |
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.
Style: please use proper capitalization in comments.
I agree with @cjihrig that it's somewhat inconsistent to apply it only to the fs.access() flags. |
change the fs.F_OK/R_OK/W_OK/X_OK out of fs.js will lead unexpect exception. make these properties readonly.
@bnoordhuis Updated by your comment. Thanks. |
LGTM but I defer to @cjihrig. |
I'll land this today. |
These flags were defined as constants, but could be overwritten when exported from fs. This commit exports the flags as read only properties of fs. PR-URL: #507 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Thanks! Landed with a slightly reworded commit message in 8b98096. |
change the fs.F_OK/R_OK/W_OK/X_OK out of fs.js will lead unexpect
exception. make these properties readonly.