Skip to content

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

Merged
merged 3 commits into from
Jun 16, 2016
Merged

Add ERROR_FILE_EXISTS to ErrorKind conversion on Windows #34270

merged 3 commits into from
Jun 16, 2016

Conversation

@Stebalien
Copy link
Contributor

How hard would it be to add a platform-independent test case for this (so it doesn't show up again)?

@gkoz
Copy link
Contributor Author

gkoz commented Jun 14, 2016

Sorry, it's not obvious to me whether by 'this' you mean inaccurate ErrorKind::Other in general or something more specific.

@alexcrichton
Copy link
Member

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 AlreadyExists

@Stebalien
Copy link
Contributor

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 AlreadyExists

Ideally one that doesn't check for any specific platforms.

@gkoz
Copy link
Contributor Author

gkoz commented Jun 14, 2016

Added a test.

@alexcrichton
Copy link
Member

@bors: r+ 973ec7cfa9a14bc825102188e8ad40ff3d733cda

Thanks!

@bors
Copy link
Collaborator

bors commented Jun 15, 2016

⌛ Testing commit 973ec7c with merge ccd3352...

@bors
Copy link
Collaborator

bors commented Jun 15, 2016

💔 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();
Copy link
Contributor Author

@gkoz gkoz Jun 15, 2016

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?

Copy link
Member

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.

@gkoz
Copy link
Contributor Author

gkoz commented Jun 15, 2016

Removed fancy test cases.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Jun 15, 2016

📌 Commit 552afd3 has been approved by alexcrichton

bors added a commit that referenced this pull request Jun 16, 2016
Rollup of 4 pull requests

- Successful merges: #34207, #34268, #34270, #34290
- Failed merges:
@bors bors merged commit 552afd3 into rust-lang:master Jun 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants