Skip to content

Commit 49a1ab8

Browse files
garethgareth
gareth
authored and
gareth
committed
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.
1 parent 76c3121 commit 49a1ab8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libstd/run.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,13 +1108,15 @@ mod tests {
11081108
#[test]
11091109
fn test_change_working_directory() {
11101110
1111-
let tmp_path = os::tmpdir().normalize();
1112-
let mut prog = run_pwd(Some(&tmp_path));
1111+
// test changing to the parent of os::getcwd() because we know
1112+
// the path exists (and os::getcwd() is not expected to be root)
1113+
let parent_path = os::getcwd().dir_path().normalize();
1114+
let mut prog = run_pwd(Some(&parent_path));
11131115
11141116
let output = str::from_bytes(prog.finish_with_output().output);
11151117
let child_dir = Path(output.trim()).normalize();
11161118
1117-
assert_eq!(child_dir.to_str(), tmp_path.to_str());
1119+
assert_eq!(child_dir.to_str(), parent_path.to_str());
11181120
}
11191121
11201122
#[cfg(unix)]

0 commit comments

Comments
 (0)