Skip to content

Commit bef2469

Browse files
committed
ui-tests: improve RunWaitOne()
There is actually no need to have a flashing window just to capture the output of the command: using the trick (use `Run()`, pipe to `clip` and then use `A_Clipboard`) from https://stackoverflow.com/a/32298415 makes it possible to hide the console window _and_ capture the output. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6f81e28 commit bef2469

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ui-tests/ui-test-library.ahk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ ExitWithError(error) {
5555
}
5656

5757
RunWaitOne(command) {
58+
SavedClipboard := ClipboardAll
5859
shell := ComObject("WScript.Shell")
5960
; Execute a single command via cmd.exe
60-
exec := shell.Exec(A_ComSpec " /C " command)
61+
exec := shell.Run(A_ComSpec " /C " command " | clip", 0, true)
6162
; Read and return the command's output
62-
return exec.StdOut.ReadAll()
63+
Result := A_Clipboard
64+
Clipboard := SavedClipboard
65+
return Result
6366
}
6467

6568
; This function is quite the hack. It assumes that the Windows Terminal is the active window,

0 commit comments

Comments
 (0)