src: define S_IWUSR & S_IRUSR for Windows#42748
src: define S_IWUSR & S_IRUSR for Windows#42748ilg-ul wants to merge 19 commits intonodejs:masterfrom xpack:S_IWUSR
Conversation
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and `chmod()` can use them. This patch defines two aliases, so that these definintions are issued in `fs.constants`. #41591
|
cc @nodejs/platform-windows @nodejs/libuv |
|
Please note that I do not have a Windows build environment available, and I could not check if this patch added the two definitions to fs.constants; this probably should be added to the tests, but I don't know how to do it. |
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and `chmod()` can use them. This patch defines two aliases, so that these definintions are issued in `fs.constants`. #41591
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and `chmod()` can use them. This patch defines two aliases, so that these definintions are issued in `fs.constants`. refs: #41591
bnoordhuis
left a comment
There was a problem hiding this comment.
LGTM with some suggestions.
| assert.ok(fs.constants.S_IRUSR !== undefined); | ||
| assert.ok(fs.constants.S_IWUSR !== undefined); |
There was a problem hiding this comment.
It'd be better to use assert.notStrictEqual() here. The "is windows?" guard is better written as:
if (!common.isWindows)
common.skip('Windows-only test');Although in its current incarnation it's not really Windows-specific. You could just remove the guard altogether and rename the file.
RaisinTen
left a comment
There was a problem hiding this comment.
LGTM but could you please get rid of the merge commits? It negatively affects our tooling.
Oops! I thought it is something wrong :-( I'm using VS Code -> Amend. I should have used plain commit, right? |
|
If the mess creates any problems, we can abandon this PR and I can try to create a new one, hopefully cleaner. |
|
Any idea how I managed to break the ASan test? |
|
That looks like a flaky test, not anything caused by this PR. Apropos merge commits: |
|
Recreated as #42757. |
On Windows, most of the POSIX file mode definitions are not available.
However, functionally equivalent read/write definitions exists, and
chmod()can use them. This patch defines two aliases, so that thesedefinintions are issued in
fs.constants.Fixes: #41591