Compile launcher Windows as a GUI binary to avoid cmd window prompts #1007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed #943
This PR includes the change to enable Windows launcher to be built as a GUI binary instead of a console binary. We originally reverted this code but it appears this doesn't break autoupdate like we originally feared.
The second change updates the CI check to ignore any output and just verify that
launcher --version
ran successfully. This better matches the check that the autoupdate code performs on binaries.Behavior changes
Windows CMD will wait for console binaries and return their output, whereas GUI binaries are not waited for and no output is returned:
To get the output of a GUI binary, we can invoke it via
start
, wait for the output, and redirect it.PowerShell will automatically apply
Out-String
to a command's output before sending it to the input of another cmdlet, likefindstr
:Testing Notes
I was unable to reproduce any bad autoupdate behavior when injecting a GUI binary into the tests for the autoupdate
checkExecutable
code which callslauncher --version
:I verified replacing my existing launcher installation
updates
dir binaries with GUI binaries still launches successfully.Some helpful references:
https://stackoverflow.com/questions/54536/win32-gui-app-that-writes-usage-text-to-stdout-when-invoked-as-app-exe-help
https://superuser.com/questions/1198821/how-do-i-read-the-console-output-of-a-windows-gui-application
https://www.sapien.com/blog/2014/12/15/display-output-in-a-gui-application-copy/
https://devblogs.microsoft.com/oldnewthing/20090101-00/?p=19643