From cf746c0179ccfab8bbd7dcb83c43d91aa96bb102 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 24 Jul 2024 15:45:08 +0200 Subject: [PATCH] fix: use symlink and straight copy as fallback methods for buntar --- backend/windmill-worker/src/bun_executor.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/windmill-worker/src/bun_executor.rs b/backend/windmill-worker/src/bun_executor.rs index dc6f017231..322a500776 100644 --- a/backend/windmill-worker/src/bun_executor.rs +++ b/backend/windmill-worker/src/bun_executor.rs @@ -468,7 +468,18 @@ pub fn copy_recursively( fs::create_dir_all(&destination)?; copy_recursively(entry.path(), &destination, None)?; } else { - fs::hard_link(entry.path(), &destination)?; + let original = entry.path(); + if let Err(e) = fs::hard_link(&original, &destination) { + tracing::error!( + "Could not hard link {original:?} to {destination:?}, trying symlink: {e:#}" + ); + if let Err(e) = std::os::unix::fs::symlink(&original, &destination) { + tracing::error!( + "Could not symlink {original:?} to {destination:?}, copying: {e:#}" + ); + fs::copy(&original, &destination)?; + } + } } } Ok(()) @@ -587,6 +598,7 @@ pub async fn handle_bun_job( "package.json".to_string(), "bun.lockb".to_string(), "shared".to_string(), + "bunfig.toml".to_string(), ]), ) { fs::remove_dir_all(&buntar_path)?;