Skip to content

Commit 68c03cd

Browse files
committed
Skip a test if symlink creation is not possible
1 parent 3153584 commit 68c03cd

File tree

1 file changed

+9
-2
lines changed
  • library/std/src/sys/windows/process

1 file changed

+9
-2
lines changed

library/std/src/sys/windows/process/tests.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,15 @@ fn windows_exe_resolver() {
186186
let temp = tmpdir();
187187
let mut exe_path = temp.path().to_owned();
188188
exe_path.push("exists.exe");
189-
symlink("<DOES NOT EXIST>".as_ref(), &exe_path).unwrap();
190189

191190
// A broken symlink should still be resolved.
192-
assert!(resolve_exe(OsStr::new("exists.exe"), empty_paths, Some(temp.path().as_ref())).is_ok());
191+
// Skip this check if not in CI and creating symlinks isn't possible.
192+
let is_ci = env::var("CI").is_ok();
193+
let result = symlink("<DOES NOT EXIST>".as_ref(), &exe_path);
194+
if is_ci || result.is_ok() {
195+
result.unwrap();
196+
assert!(
197+
resolve_exe(OsStr::new("exists.exe"), empty_paths, Some(temp.path().as_ref())).is_ok()
198+
);
199+
}
193200
}

0 commit comments

Comments
 (0)