From 8eb77a08b6d4a51761794d9dddb3f05c8a1864ec Mon Sep 17 00:00:00 2001 From: Emilia Daelman Date: Sun, 15 Feb 2026 18:30:33 +0100 Subject: [PATCH] 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 --- tests/uutests/src/lib/util.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/uutests/src/lib/util.rs b/tests/uutests/src/lib/util.rs index eaa9c868d..162584007 100644 --- a/tests/uutests/src/lib/util.rs +++ b/tests/uutests/src/lib/util.rs @@ -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