ok/jj
1
0
Fork 0
forked from mirrors/jj

tests: fix some failures on windows due to a missing TEMP environment variable

This commit is contained in:
Thomas Castiglione 2024-02-14 22:38:26 +08:00 committed by gulbanana
parent 38b27de8e3
commit fed682a430

View file

@ -114,7 +114,14 @@ impl TestEnvironment {
cmd.env("SSL_CERT_FILE", "/dev/null");
}
if cfg!(all(windows, target_env = "gnu")) {
if cfg!(windows) {
// Windows uses `TEMP` to create temporary directories, which we need for some
// tests.
if let Ok(tmp_var) = std::env::var("TEMP") {
cmd.env("TEMP", tmp_var);
}
if cfg!(target_env = "gnu") {
// MinGW executables cannot run without `mingw\bin` in the PATH (which we're
// clearing above), so we add it again here.
if let Ok(path_var) = std::env::var("PATH").or_else(|_| std::env::var("Path")) {
@ -129,11 +136,6 @@ impl TestEnvironment {
cmd.env("PATH", mingw_directories);
}
}
// MinGW uses `TEMP` to create temporary directories, which we need for some
// tests.
if let Ok(tmp_var) = std::env::var("TEMP") {
cmd.env("TEMP", tmp_var);
}
}