File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,6 @@ run_script = "0.11.0"
11
11
[target ."cfg(windows)" .dependencies ]
12
12
powershell_script = " 1.1.0"
13
13
14
+ [target ."cfg(windows)" .dev-dependencies ]
15
+ winreg = " 0.52.0"
16
+
Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ mod tests {
135
135
#![ allow( clippy:: unwrap_used) ]
136
136
use super :: * ;
137
137
138
+ /// open registry key for editing or reading.
139
+ fn hklm_open_subkey ( subkey : & str ) -> anyhow:: Result < winreg:: RegKey > {
140
+ let hklm = winreg:: RegKey :: predef ( winreg:: enums:: HKEY_LOCAL_MACHINE ) ;
141
+ Ok ( hklm. open_subkey ( subkey) ?)
142
+ }
143
+
138
144
#[ test]
139
145
fn test_script_multiline ( ) {
140
146
let script = r#"ls $HOME
@@ -163,13 +169,13 @@ ls $TEMP
163
169
#[ cfg( windows) ]
164
170
fn test_powershell ( ) {
165
171
let out = run_powershell ( "ls" , true ) . unwrap ( ) ;
166
- assert ! ( !out. is_empty( ) ) ;
167
- println ! ( "output=`{out}`" ) ;
172
+ assert ! ( !out. stdout . is_empty( ) ) ;
173
+ println ! ( "output=`{out:? }`" ) ;
168
174
169
175
let uuid = run_powershell (
170
176
r"(Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography).MachineGuid" ,
171
177
true ,
172
- ) . unwrap ( ) ;
178
+ ) . unwrap ( ) . stdout ;
173
179
assert ! ( !uuid. is_empty( ) ) ;
174
180
println ! ( "11 uuid=`{uuid}`" ) ;
175
181
You can’t perform that action at this time.
0 commit comments