From 0062e54b5ed7a3fecfb760c306f8be4a77583e60 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Fri, 20 Aug 2021 00:20:56 +0200 Subject: [PATCH] test_util_name: symlink the xecutable instead of copying Speculative fix for "text file busy" errors. --- tests/test_util_name.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_util_name.rs b/tests/test_util_name.rs index 640fecd44..b0a78a2e8 100644 --- a/tests/test_util_name.rs +++ b/tests/test_util_name.rs @@ -2,6 +2,11 @@ mod common; use common::util::TestScenario; +#[cfg(unix)] +use std::os::unix::fs::symlink as symlink_file; +#[cfg(windows)] +use std::os::windows::fs::symlink_file; + #[test] #[cfg(feature = "ls")] fn execution_phrase_double() { @@ -24,7 +29,7 @@ fn execution_phrase_single() { use std::process::Command; let scenario = TestScenario::new("ls"); - std::fs::copy(scenario.bin_path, scenario.fixtures.plus("uu-ls")).unwrap(); + symlink_file(scenario.bin_path, scenario.fixtures.plus("uu-ls")).unwrap(); let output = Command::new(scenario.fixtures.plus("uu-ls")) .arg("--some-invalid-arg") .output() @@ -65,7 +70,7 @@ fn util_name_single() { }; let scenario = TestScenario::new("sort"); - std::fs::copy(scenario.bin_path, scenario.fixtures.plus("uu-sort")).unwrap(); + symlink_file(scenario.bin_path, scenario.fixtures.plus("uu-sort")).unwrap(); let mut child = Command::new(scenario.fixtures.plus("uu-sort")) .stdin(Stdio::piped()) .stderr(Stdio::piped())