diff options
| author | Cadence Marseille <cadencemarseille@gmail.com> | 2013-12-08 17:12:41 -0500 |
|---|---|---|
| committer | Cadence Marseille <cadencemarseille@gmail.com> | 2013-12-17 08:08:19 -0500 |
| commit | 33ca3e35bebdb3f1b718feb374df1fa24a1ad73a (patch) | |
| tree | 711fe768ab10d2583f02d3604636725d1bfaee7f /src/libstd | |
| parent | e7b0e0adbbb9f41f79592822ffe1e5834222a96b (diff) | |
| download | rust-33ca3e35bebdb3f1b718feb374df1fa24a1ad73a.tar.gz rust-33ca3e35bebdb3f1b718feb374df1fa24a1ad73a.zip | |
Handle ENOENT
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 c1f75465d9c..76ce1e4dc6b 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -194,7 +194,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 14d49df59a4..84c1329223b 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -340,7 +340,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) @@ -354,9 +354,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", []) }); |
