From 2372ef7e7af80b902bd084b4271b5b3c2973ff61 Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Mon, 20 Apr 2026 07:21:11 +0200 Subject: [PATCH] fix(windows): gate permissions chmod behind cfg(unix) install_hook() called Permissions::from_mode(0o755) unconditionally, breaking the Windows release build with E0433/E0599. Windows git runs hooks through Git-Bash regardless of NTFS executable bits, so skipping the chmod is safe. Blocks the v0.4.0 cross-platform release. Trace: skip --- rivet-cli/src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rivet-cli/src/main.rs b/rivet-cli/src/main.rs index 0b20b16..999ce19 100644 --- a/rivet-cli/src/main.rs +++ b/rivet-cli/src/main.rs @@ -2504,8 +2504,6 @@ fn which_rivet() -> String { /// /// This allows coexistence with pre-commit, husky, lefthook, etc. fn install_hook(path: &std::path::Path, content: &str) -> Result<()> { - use std::os::unix::fs::PermissionsExt; - if path.exists() { let prev = path.with_extension("prev"); // Don't overwrite an existing .prev (user may have modified it) @@ -2530,8 +2528,13 @@ fn install_hook(path: &std::path::Path, content: &str) -> Result<()> { let final_content = format!("{content}{chain_snippet}"); std::fs::write(path, &final_content).with_context(|| format!("writing {}", path.display()))?; - std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755)) - .with_context(|| format!("setting permissions on {}", path.display()))?; + + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755)) + .with_context(|| format!("setting permissions on {}", path.display()))?; + } Ok(()) }