diff options
| author | bors <bors@rust-lang.org> | 2013-12-17 10:21:44 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-17 10:21:44 -0800 |
| commit | fe85856dc945c7e5eb83e05bdbd72fe1acd6d1c0 (patch) | |
| tree | e9a65bddef89b630cf39cb6adc21208238172971 /src/libstd | |
| parent | b870ce7a9fe1368462c3ba8b62a1f85c9e5444ce (diff) | |
| parent | 33ca3e35bebdb3f1b718feb374df1fa24a1ad73a (diff) | |
| download | rust-fe85856dc945c7e5eb83e05bdbd72fe1acd6d1c0.tar.gz rust-fe85856dc945c7e5eb83e05bdbd72fe1acd6d1c0.zip | |
auto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichton
Translate ENOENT to IoErrorKind::FileNotFound.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/net/unix.rs | 2 | ||||
| -rw-r--r-- | src/libstd/run.rs | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index 49770b80060..2766aa9ad27 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -191,7 +191,7 @@ mod tests { do run_in_mt_newsched_task { let mut called = false; io_error::cond.trap(|e| { - assert_eq!(e.kind, OtherIoError); + assert_eq!(e.kind, FileNotFound); called = true; }).inside(|| { let stream = UnixStream::connect(&("path/to/nowhere")); diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 70ad752ea93..3c4d06bc71f 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -339,7 +339,7 @@ mod tests { use task::spawn; use unstable::running_on_valgrind; use io::native::file; - use io::{Writer, Reader, io_error}; + use io::{FileNotFound, OtherIoError, Reader, Writer, io_error}; #[test] #[cfg(not(target_os="android"))] // FIXME(#10380) @@ -353,9 +353,14 @@ mod tests { #[test] fn test_process_output_fail_to_start() { + // If the executable does not exist, then the io_error condition should be raised with + // IoErrorKind FileNotFound. + let mut trapped_io_error = false; - let opt_outp = io_error::cond.trap(|_| { + let opt_outp = io_error::cond.trap(|e| { trapped_io_error = true; + // FIXME(#11023) + assert_eq!(e.kind, if cfg!(windows) { OtherIoError } else { FileNotFound }); }).inside(|| -> Option<run::ProcessOutput> { run::process_output("no-binary-by-this-name-should-exist", []) }); |
