mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +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,8 +282,20 @@ impl UCommand {
|
||||||
let mut cmd = Command::new(arg.as_ref());
|
let mut cmd = Command::new(arg.as_ref());
|
||||||
cmd.current_dir(curdir.as_ref());
|
cmd.current_dir(curdir.as_ref());
|
||||||
if env_clear {
|
if 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.env_clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cmd
|
cmd
|
||||||
},
|
},
|
||||||
comm_string: String::from(arg.as_ref().to_str().unwrap()),
|
comm_string: String::from(arg.as_ref().to_str().unwrap()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue