-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows #34270
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
Conversation
How hard would it be to add a platform-independent test case for this (so it doesn't show up again)? |
Sorry, it's not obvious to me whether by 'this' you mean inaccurate |
I believe what @Stebalien means is could we add a test for this? Ideally one that runs on both Unix and Windows and both situations give us |
Ideally one that doesn't check for any specific platforms. |
Added a test. |
@bors: r+ 973ec7cfa9a14bc825102188e8ad40ff3d733cda Thanks! |
⌛ Testing commit 973ec7c with merge ccd3352... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
assert_eq!(e.kind(), ErrorKind::AlreadyExists); | ||
let dir = &tmpdir.join("file_create_new_exists_dir"); | ||
check!(fs::create_dir(dir)); | ||
let e = fs::OpenOptions::new().write(true).create_new(true).open(dir).unwrap_err(); |
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.
Apparently on Windows an this (creating a file when a directory exists) results in ErrorKind::PermissionDenied
. Should I just not test this or make it conditional on !windows
?
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.
It's fine to just omit this test if the PR is covered by the one above.
Removed fancy test cases. |
@bors: r+ |
📌 Commit 552afd3 has been approved by |
Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows Bug report: https://users.rust-lang.org/t/detecting-error-kind-for-opening-file/6215 Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx#error_file_exists
Bug report: https://users.rust-lang.org/t/detecting-error-kind-for-opening-file/6215
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx#error_file_exists