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"
1111[target ."cfg(windows)" .dependencies ]
1212powershell_script = " 1.1.0"
1313
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 {
135135 #![ allow( clippy:: unwrap_used) ]
136136 use super :: * ;
137137
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+
138144 #[ test]
139145 fn test_script_multiline ( ) {
140146 let script = r#"ls $HOME
@@ -163,13 +169,13 @@ ls $TEMP
163169 #[ cfg( windows) ]
164170 fn test_powershell ( ) {
165171 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:? }`" ) ;
168174
169175 let uuid = run_powershell (
170176 r"(Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography).MachineGuid" ,
171177 true ,
172- ) . unwrap ( ) ;
178+ ) . unwrap ( ) . stdout ;
173179 assert ! ( !uuid. is_empty( ) ) ;
174180 println ! ( "11 uuid=`{uuid}`" ) ;
175181
You can’t perform that action at this time.
0 commit comments