From 4d9ec909d1af7d123fec1a64143615e6cd0bba7e Mon Sep 17 00:00:00 2001 From: wendrul <53628737+wendrul@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:14:19 +0100 Subject: [PATCH] fix: playbook files permission mode incompatible with Windows (#4740) --- backend/windmill-common/src/worker.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/windmill-common/src/worker.rs b/backend/windmill-common/src/worker.rs index 2bd777623dfcd..3630de067424a 100644 --- a/backend/windmill-common/src/worker.rs +++ b/backend/windmill-common/src/worker.rs @@ -229,12 +229,18 @@ pub fn write_file_at_user_defined_location( let mut file = File::create(full_path)?; + #[cfg(unix)] if let Some(mode) = mode { let perm = std::os::unix::fs::PermissionsExt::from_mode(mode); file.set_permissions(perm) .map_err(|e| anyhow!("Failed to set permissions to {}: {e}", user_defined_path))?; } + #[cfg(windows)] + if mode.is_some() { + tracing::error!("Cannot use `mode` to set file permissions on windows workers"); + } + file.write_all(content.as_bytes())?; file.flush()?; Ok(normalized_full_path)