fix: worker symlink dir + path fixes + npm postinstall on windows (#6167)

This commit is contained in:
Alexander Petric
2025-07-11 16:51:48 -04:00
committed by GitHub
parent 71ec6b3482
commit 4502d66fd3
2 changed files with 26 additions and 5 deletions

View File

@@ -82,7 +82,7 @@ use serde_json::value::RawValue;
use tokio::fs::symlink;
#[cfg(target_os = "windows")]
use tokio::fs::symlink_file as symlink;
use tokio::fs::symlink_dir;
use tokio::{
sync::{
@@ -1714,9 +1714,30 @@ pub async fn run_worker(
let parent_flow = job.parent_job.unwrap();
let parent_shared_dir = format!("{worker_dir}/{parent_flow}/shared");
create_directory_async(&parent_shared_dir).await;
symlink(&parent_shared_dir, target)
.await
.expect("could not symlink target");
#[cfg(windows)]
{
// On Windows, try symlink_dir
let windows_target = target.replace("/", "\\");
let windows_parent = parent_shared_dir.replace("/", "\\");
match symlink_dir(&windows_parent, &windows_target).await {
Ok(_) => {
tracing::info!("Successfully created directory symlink on Windows");
}
Err(e) => {
tracing::warn!("Failed to create symlink_dir on Windows (likely needs admin privileges or Developer Mode): {}", e);
create_directory_async(&target).await;
}
}
}
#[cfg(not(windows))]
{
symlink(&parent_shared_dir, &target)
.await
.expect("could not symlink target");
}
}
} else {
create_directory_async(target).await;

View File

@@ -5,7 +5,7 @@
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"postinstall": "if [ -f ./scripts/untar_ui_builder.js ]; then node ./scripts/untar_ui_builder.js && node ./scripts/patch_files.js; fi",
"postinstall": "node -e \"if (require('fs').existsSync('./scripts/untar_ui_builder.js')) { require('child_process').execSync('node ./scripts/untar_ui_builder.js && node ./scripts/patch_files.js', {stdio: 'inherit'}) }\"",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --threshold warning",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",