From 91b042b113eab7a1596f1c6c38316aa0ccb87778 Mon Sep 17 00:00:00 2001 From: bicarlsen Date: Mon, 28 Oct 2024 03:07:25 -0600 Subject: [PATCH] Strip UNC paths when running hook commands on Windows. (#891) --- src/hooks.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hooks.rs b/src/hooks.rs index 799feffa..f8ac4f96 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -15,8 +15,14 @@ pub fn spawn_hooks(cfg: Arc, stage: PipelineStage) -> HookHandles { .filter(|hook_cfg| hook_cfg.stage == stage) .map(|hook_cfg| { let mut command = Command::new(hook_cfg.command()); + let current_dir = if cfg!(target_os = "windows") { + dunce::simplified(&cfg.core.working_directory) + } else { + cfg.core.working_directory.as_path() + }; + command - .current_dir(&cfg.core.working_directory) + .current_dir(current_dir) .args(hook_cfg.command_arguments()) .stdout(Stdio::inherit()) .stderr(Stdio::inherit())