-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Handle ENOENT #10863
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
Handle ENOENT #10863
Conversation
Can you add a test for this as well? |
Hi @alexcrichton, I added a test that I have been trying to get working, but it always fails for some reason, even when I comment out the two asserts. Do you know why the test is not working? I'm confused because if I change line 71 of rust-pcre's package script and mistype "rust-pcre", then the io_error condition is raised and the IoErrorKind is FileNotFound (using Every time I run failures: run::tests::test_process_output_io_error_file_not_found test result: FAILED. 1316 passed; 1 failed; 92 ignored; 0 measured task '' failed at 'Some tests failed', /Users/cadencemarseille/Projects/rust/src/libextra/test.rs:168 |
I suppose that this depends on the test case that you're trying here. I would recommend having a simpler test case which doesn't involve spawning processes. Otherwise there's a very large amount of unknown (to me) code in play so it's tough for me to understand what's going on here. |
I split out the test code into a standalone file and it fails with: task '' failed at 'called `Option::unwrap()` on a `None` value', /Users/cadencemarseille/Projects/rust/src/libstd/option.rs:135 This looks like Issue #10754 As far as a simpler test, would a test that checks whether |
Sorry I didn't mean for this to become a long saga of figuring out how to write a test, I just wanted something in the code to assert that ENOENT showed up. As you found out in the unix tests, one of them gives ENOENT and that's good enough for me. There are many ways to trigger an ENOENT without spawning a process, so if that's blocking you have you tried doing things like listing a directory that doesn't exist or reading a file that doesn't exist? |
We really frequently get different errors on windows, so for now it's fine to just have a different assertion for windows than you have for unix, e.g. |
Translate ENOENT to IoErrorKind::FileNotFound.
…lexcrichton Translate ENOENT to IoErrorKind::FileNotFound.
Translate ENOENT to IoErrorKind::FileNotFound.