about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorgareth <gareth@gareth-N56VM.(none)>2013-05-14 20:10:14 +0100
committergareth <gareth@gareth-N56VM.(none)>2013-05-27 13:50:33 +0100
commit49a1ab8745338e6ac6da65c3fc4e541761f6c760 (patch)
tree0ffb125b9abe9335fda69ff34678f69c904edb5b /src/libstd
parent76c31217bee0f80b096b33d8a1b499f491d92c9f (diff)
downloadrust-49a1ab8745338e6ac6da65c3fc4e541761f6c760.tar.gz
rust-49a1ab8745338e6ac6da65c3fc4e541761f6c760.zip
Make test_change_working_directory change the current
directory to be the parent of the current-current directory,
instead of changing to the tmp directory, which was causing
issues with OS X and its /tmp => /private/tmp symlink.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/run.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libstd/run.rs b/src/libstd/run.rs
index 1956f4baba6..8f507653124 100644
--- a/src/libstd/run.rs
+++ b/src/libstd/run.rs
@@ -1108,13 +1108,15 @@ mod tests {
     #[test]
     fn test_change_working_directory() {
 
-        let tmp_path = os::tmpdir().normalize();
-        let mut prog = run_pwd(Some(&tmp_path));
+        // test changing to the parent of os::getcwd() because we know
+        // the path exists (and os::getcwd() is not expected to be root)
+        let parent_path = os::getcwd().dir_path().normalize();
+        let mut prog = run_pwd(Some(&parent_path));
 
         let output = str::from_bytes(prog.finish_with_output().output);
         let child_dir = Path(output.trim()).normalize();
 
-        assert_eq!(child_dir.to_str(), tmp_path.to_str());
+        assert_eq!(child_dir.to_str(), parent_path.to_str());
     }
 
     #[cfg(unix)]