From 8890539e400d20f44b85f056b0b456967f5a1a53 Mon Sep 17 00:00:00 2001 From: Hrvoje Ban Date: Wed, 27 Mar 2019 07:52:59 +0100 Subject: [PATCH] Use EXE extension for pre-commit hook on Window --- crates/tools/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 1e29c63d464..11b52ccb7f0 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -115,7 +115,11 @@ pub fn install_rustfmt() -> Result<()> { } pub fn install_format_hook() -> Result<()> { - let result_path = Path::new("./.git/hooks/pre-commit"); + let result_path = Path::new(if cfg!(windows) { + "./.git/hooks/pre-commit.exe" + } else { + "./.git/hooks/pre-commit" + }); if !result_path.exists() { run("cargo build --package tools --bin pre-commit", ".")?; if cfg!(windows) {