summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-30 18:11:30 -0800
committerbors <bors@rust-lang.org>2014-01-30 18:11:30 -0800
commitb7f673a627c674b289721ee339fd2980919c6afd (patch)
tree9534744c89ab638a64af8d5f4454c196c6b245e4 /src/libstd
parent7ac516a13bced2f5050032a897f79a1753499fb2 (diff)
parent506c71c980ab97f28e89032c2bba9a471c0b1fd4 (diff)
downloadrust-b7f673a627c674b289721ee339fd2980919c6afd.tar.gz
rust-b7f673a627c674b289721ee339fd2980919c6afd.zip
auto merge of #11784 : eminence/rust/fix_run_tests, r=alexcrichton
This test is designed to ensure that running a non-existent executable
results in a correct error message (FileNotFound in this case of this
test).  However, if you try to run an executable that doesn't exist, and
that requires searching through the $PATH, and one of the $PATH components
is not readable, then a PermissionDenied error will be returned, instead
of FileNotFound.

Using an absolute path skips the $PATH search logic in exec, thus by-passing the logic in exec that would have returned a PermissionDenied

In the specific case of my machine, /usr/bin/games was part of $PATH, but my user account wasn't in the games group (thus being unable to read /usr/bin/games)

See the man pages for execv and execve for more details.

I've tested this on Linux and OSX, and I am fairly certain that there will be no problems on Windows
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/run.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/run.rs b/src/libstd/run.rs
index 482477b2f0e..ef2374f6095 100644
--- a/src/libstd/run.rs
+++ b/src/libstd/run.rs
@@ -360,7 +360,7 @@ mod tests {
             trapped_io_error = true;
             assert_eq!(e.kind, FileNotFound);
         }).inside(|| -> Option<run::ProcessOutput> {
-            run::process_output("no-binary-by-this-name-should-exist", [])
+            run::process_output("/no-binary-by-this-name-should-exist", [])
         });
         assert!(trapped_io_error);
         assert!(opt_outp.is_none());