Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Windows: fs.chmod/fs.chmodSync can only set 444 or 666 #4812

Description

@JamesMGreene

Just made a plugin task for Grunt that wraps Node core's fs.chmodSync method to set file permissions.

However, running on Windows 7 (not tested elsewhere), it seems that the only values I can successfully set it to are 444 or 666.

Attempts with other unexpected results:

  • 400444
  • 644666
  • 755666

While I admit Windows has its quirks, I'm quite sure you can do better than this with cacls/xcacls/icacls (as well as whatever C/C++/Win32 functionality is available, I'm sure). I know the VC++ runtime also has a _chmod method but, IIRC, Node.js core does not depend on VC++ on Windows, so that wouldn't be an option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions