mirror of
https://github.com/uutils/coreutils
synced 2024-11-16 09:48:03 +00:00
tests: do not remove %SYSTEMROOT% from environment variables, it's required to initialize crypto provider (which is required for std::rand)
This commit is contained in:
parent
2ddea8aa88
commit
1ae82193f0
1 changed files with 13 additions and 1 deletions
|
@ -282,7 +282,19 @@ impl UCommand {
|
|||
let mut cmd = Command::new(arg.as_ref());
|
||||
cmd.current_dir(curdir.as_ref());
|
||||
if env_clear {
|
||||
cmd.env_clear();
|
||||
if cfg!(windows) {
|
||||
// %SYSTEMROOT% is required on Windows to initialize crypto provider
|
||||
// ... and crypto provider is required for std::rand
|
||||
// From procmon: RegQueryValue HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider\Image Path
|
||||
// SUCCESS Type: REG_SZ, Length: 66, Data: %SystemRoot%\system32\rsaenh.dll"
|
||||
for (key, _) in env::vars_os() {
|
||||
if key.as_os_str() != "SYSTEMROOT" {
|
||||
cmd.env_remove(key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cmd.env_clear();
|
||||
}
|
||||
}
|
||||
cmd
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue