From cb707395a1f1c687da9e7be53504847fb07b1da0 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Thu, 30 Jul 2026 20:41:49 -0400 Subject: [PATCH] Launch Windows desktop without a console window --- .github/workflows/integration-tests.yml | 26 ++++++++++++++----- packaging/installers/installer_contract.json | 1 + .../installers/windows/Install-OpenHCS.ps1 | 25 ++++++++++++++---- pyproject.toml | 4 ++- scripts/render_installer_contract.py | 8 ++++++ tests/installer/test_installer_contract.py | 6 +++++ .../test_windows_simple_installer.py | 7 +++++ 7 files changed, 65 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 74e8941e4..3ae61dd9a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -631,19 +631,33 @@ jobs: try { $shortcut = $shell.CreateShortcut($summary.shortcut_path) try { - $expectedArguments = ( - '-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "{0}"' -f - $summary.launcher_path + $contract = Get-Content -LiteralPath $contractPath -Raw | + ConvertFrom-Json + $environment = @( + Get-ChildItem ` + -LiteralPath (Join-Path $installRoot "environments") ` + -Directory ) - if ($shortcut.TargetPath -ne $powerShellExecutable) { + if ($environment.Count -ne 1) { + throw "Windows install did not retain exactly one environment." + } + $expectedGuiExecutable = Join-Path ` + $environment[0].FullName ` + ("Scripts\{0}.exe" -f $contract.gui_entry_point) + if ($shortcut.TargetPath -ne $expectedGuiExecutable) { throw "Desktop shortcut targets '$($shortcut.TargetPath)'." } - if ($shortcut.Arguments -ne $expectedArguments) { - throw "Desktop shortcut arguments do not target the launch adapter." + if (-not [string]::IsNullOrEmpty($shortcut.Arguments)) { + throw "Desktop shortcut unexpectedly supplies console arguments." } if ($shortcut.WorkingDirectory -ne $installRoot) { throw "Desktop shortcut working directory is not the install root." } + $guiSubsystem = python -c "import struct,sys; from pathlib import Path; data=Path(sys.argv[1]).read_bytes(); pe=struct.unpack_from('