From 8806870b1bf67c2f77beaf04d986cf172c7b4bf4 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 24 Feb 2025 18:36:26 +0100 Subject: [PATCH] fix: add LOCALAPPDATA env variable to python execution on windows --- .../windmill-worker/src/python_executor.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/backend/windmill-worker/src/python_executor.rs b/backend/windmill-worker/src/python_executor.rs index e98871daac..f3ea2b0c06 100644 --- a/backend/windmill-worker/src/python_executor.rs +++ b/backend/windmill-worker/src/python_executor.rs @@ -315,6 +315,11 @@ impl PyVersion { .env( "TMP", std::env::var("TMP").unwrap_or_else(|_| String::from("/tmp")), + ) + .env( + "LOCALAPPDATA", + std::env::var("LOCALAPPDATA") + .unwrap_or_else(|_| format!("{}\\AppData\\Local", HOME_ENV.as_str())), ); } @@ -354,6 +359,11 @@ impl PyVersion { .env( "TMP", std::env::var("TMP").unwrap_or_else(|_| String::from("/tmp")), + ) + .env( + "LOCALAPPDATA", + std::env::var("LOCALAPPDATA") + .unwrap_or_else(|_| format!("{}\\AppData\\Local", HOME_ENV.as_str())), ); } @@ -595,6 +605,11 @@ pub async fn uv_pip_compile( child_cmd .env("SystemRoot", SYSTEM_ROOT.as_str()) .env("USERPROFILE", crate::USERPROFILE_ENV.as_str()) + .env( + "LOCALAPPDATA", + std::env::var("LOCALAPPDATA") + .unwrap_or_else(|_| format!("{}\\AppData\\Local", HOME_ENV.as_str())), + ) .env( "TMP", std::env::var("TMP").unwrap_or_else(|_| String::from("/tmp")), @@ -1110,6 +1125,11 @@ mount {{ { python_cmd.env("SystemRoot", SYSTEM_ROOT.as_str()); python_cmd.env("USERPROFILE", crate::USERPROFILE_ENV.as_str()); + python_cmd.env( + "LOCALAPPDATA", + std::env::var("LOCALAPPDATA") + .unwrap_or_else(|_| format!("{}\\AppData\\Local", HOME_ENV.as_str())), + ); } start_child_process(python_cmd, &python_path).await? @@ -1683,6 +1703,11 @@ async fn spawn_uv_install( "TMP", std::env::var("TMP").unwrap_or_else(|_| String::from("/tmp")), ) + .env( + "LOCALAPPDATA", + std::env::var("LOCALAPPDATA") + .unwrap_or_else(|_| format!("{}\\AppData\\Local", HOME_ENV.as_str())), + ) .args(&command_args[1..]) .stdout(Stdio::piped()) .stderr(Stdio::piped());