From 48a6eb9a160c3f57f7aba60df2bd5c2429000f06 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 21 Oct 2015 09:26:02 -0700 Subject: [PATCH] Fall back to copy if hard linking fails Closes #60 --- tests/test.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test.rs b/tests/test.rs index c26d7fb..e581548 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -46,7 +46,9 @@ impl Test { fn shim(&self, name: &str) -> &Test { let fname = format!("{}{}", name, env::consts::EXE_SUFFIX); - fs::hard_link(&self.gcc, self.td.path().join(fname)).unwrap(); + fs::hard_link(&self.gcc, self.td.path().join(&fname)).or_else(|_| { + fs::copy(&self.gcc, self.td.path().join(&fname)).map(|_| ()) + }).unwrap(); self }