Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/tower-uv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ fn normalize_env_vars(env_vars: &HashMap<String, String>) -> HashMap<String, Str
// needs it to initialize it's random number generator. Fun fact!
let systemroot = std::env::var("SYSTEMROOT").unwrap_or_default();
env_vars.insert("SYSTEMROOT".to_string(), systemroot);

// We also need to bring along the TEMP environment variable because Python needs it for
// things like creating temporary files, etc.
let temp = std::env::var("TEMP").unwrap_or_default();
env_vars.insert("TEMP".to_string(), temp);

// Apparently, according to some random person on Stack Overflow, sometimes the var can be
// TEMP and sometimes it can be TMP. So uh...let's just grab both just in case.
let tmp = std::env::var("TMP").unwrap_or_default();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the honesty. We should probably try to verify this with some official documentation....somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent 5 minutes trying to find something that wasn't Stack Overflow or Reddit posts complaining about it. Generally, seems like it dates back to DOS. There's some basic docs here that reference both lol https://learn.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables

env_vars.insert("TMP".to_string(), tmp);

return env_vars;
}

Expand Down
Loading