-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Functionality missing on Windows: should it throw or noop? #4306
Comments
For anything in the For things in |
@ry preferred for open with non-default mode and mkdir with non-default mode to just silently ignore the mode; but made umask(mask) throw. I guess the underlying pattern is: there's something for Continuing that pattern, I'm thinking Or do others think differently? |
Just hit this problem with I'd say, that should be a hard error - it's better than silently hanging in some situation because op had no effect on Windows. |
@kitsonk, recently added to Rust there's |
Slight error in what I wrote there. The version of |
Having a |
I agree |
When invoked on Windows, this op now throws (see denoland#4306)
Currently chmod is a noop on Windows, while analogous functions like chown and umask throw (see denoland#4306). Symlink also currently throws, but that can be implemented on Windows, it just hasn't been done yet (see denoland#815, an implementation was crafted but there were issues that haven't been resolved yet). It's possible to implement chmod in Windows to a limited degree: Rust lets one make Windows files read-only. But the API for how this should work hasn't been settled (see denoland#4357). Until we do implement chmod on Windows, perhaps we should make it throw like the other Windows-unimplemented functions in /cli/ops/fs.rs do? If so, this PR provides an implementation, and fixes tests accordingly. Note that the current implementation of writeFile applies its `mode` option to the file regardless of whether the file was created (and does so using chmod, so it has to be touched by this PR). A forthcoming PR in the denoland#4017 series will make writeFile instead use the new `mode` option in open for new files, and so no longer rely on chmod.
Currently chmod is a noop on Windows, while analogous functions like chown and umask throw (see denoland#4306). Symlink also currently throws, but that can be implemented on Windows, it just hasn't been done yet (see denoland#815, an implementation was crafted but there were issues that haven't been resolved yet). It's possible to implement chmod in Windows to a limited degree: Rust lets one make Windows files read-only. But the API for how this should work hasn't been settled (see denoland#4357). Until we do implement chmod on Windows, perhaps we should make it throw like the other Windows-unimplemented functions in /cli/ops/fs.rs do? If so, this PR provides an implementation, and fixes tests accordingly. Note that the current implementation of writeFile applies its `mode` option to the file regardless of whether the file was created (and does so using chmod, so it has to be touched by this PR). A forthcoming PR in the denoland#4017 series will make writeFile instead use the new `mode` option in open for new files, and so no longer rely on chmod.
Given recent commits, chmod and kill now throw on Windows. So now everything looks systematic:
|
The codebase isn't consistent about what happens when requesting functionality on Windows that isn't yet (or can't be) implemented there.
Some functionality that I've pushed or have queued to push is also undecided:
What do people think we should do in these cases? Throw? or noop? I hope we can settle on a consistent pattern... though there might turn out to be corner cases where it makes sense to diverge from it.
The text was updated successfully, but these errors were encountered: