Skip to content

Commit

Permalink
Compile launcher Windows as a GUI binary to avoid cmd window prompts (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ Barrett committed Feb 2, 2023
1 parent 8246b6e commit 4f9be4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/go.yml
Expand Up @@ -79,24 +79,25 @@ jobs:
- name: Test
run: make test

# Launcher should always print its version info when called with `version` -- this is a quick
# Launcher should always successfully run and exit cleanly when called with `version` -- this is a quick
# check to ensure that launcher can update to this build.
- name: Test build - macOS and ubuntu
if: ${{ contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu') }}
run: |
if [[ $(./build/launcher --version) != *"launcher - version"* ]]; then
echo "launcher version did not print version information"
if ! ./build/launcher --version; then
echo "launcher.exe --version failed"
exit 1
fi
# Launcher should always print its version info when called with `version` -- this is a quick
# Launcher should always successfully run and exit cleanly when called with `version` -- this is a quick
# check to ensure that launcher can update to this build.
- name: Test build - Windows
if: ${{ contains(matrix.os, 'windows') }}
shell: powershell
run: |
if(-not (.\build\launcher.exe --version | findstr "launcher - version")) {
throw "launcher.exe version did not print version information"
.\build\launcher.exe --version
if( !$? ) {
throw "launcher.exe --version failed"
}
- name: Upload Build - Windows
Expand Down
5 changes: 5 additions & 0 deletions pkg/make/builder.go
Expand Up @@ -509,6 +509,11 @@ func (b *Builder) BuildCmd(src, appName string) func(context.Context) error {
ldFlags = append(ldFlags, "-w -s")
}

if b.os == "windows" {
// this prevents a cmd prompt opening up when desktop is launched
ldFlags = append(ldFlags, "-H windowsgui")
}

if b.stampVersion {
v, err := b.getVersion(ctx)
if err != nil {
Expand Down

0 comments on commit 4f9be4c

Please sign in to comment.