uutests: preserve PATH in UCommand to fix NixOS test failures

This ensures that the PATH environment variable is preserved even when cleared, allowing tests to find system utilities on NixOS where they are not in standard locations like /bin.

Fixes #10756
This commit is contained in:
Emilia Daelman
2026-02-16 10:37:57 +01:00
committed by Daniel Hofstetter
parent 5cd51b3f45
commit 8eb77a08b6
+6
View File
@@ -1823,6 +1823,12 @@ impl UCommand {
}
command.env_clear();
// Preserve PATH
if let Some(path) = env::var_os("PATH") {
command.env("PATH", path);
}
if cfg!(windows) {
// spell-checker:ignore (dll) rsaenh
// %SYSTEMROOT% is required on Windows to initialize crypto provider