Fix Windows CLI output (attach console for GUI subsystem exe) — v2.17.1 - #230
Conversation
QtMeshEditor.exe is built as WIN32 (GUI subsystem), so it has no
console attached when launched from PowerShell or cmd. All cliWrite()
calls silently dropped output, causing --version, --help, and all
subcommands to produce no visible output.
Fix: call AttachConsole(ATTACH_PARENT_PROCESS) + freopen("CONOUT$")
when CLI mode is detected on Windows, before CLIPipeline::run().
Bumps version to 2.17.1.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughProject version bumped to 2.17.1 in CMake. Windows-only CLI startup now reattaches to the parent console and redirects stdout/stderr before running the CLI pipeline. CI release workflow gains Windows-only smoke tests that execute the built CLI and verify its version output. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…lures Two new steps in the Windows build job: - "Smoke-test CLI (bin directory)": always runs (PRs too), executes qtmesh.exe --version from the built bin/ dir and verifies output matches 'qtmesh X.Y.Z'. Catches missing Qt/MinGW DLLs early. - "Smoke-test CLI from zip": release-only, extracts the zip to a temp dir and re-runs the check from the exact artifact that will be uploaded. Catches any DLLs omitted from the zip packaging. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/deploy.yml (1)
345-363: Tighten zip smoke-test assertion to avoid false positives.Current validation only checks that the version text appears somewhere. It can pass even if output format is wrong. Consider asserting the full expected output shape.
Proposed refinement
- if ($output -notmatch [regex]::Escape($version)) { - Write-Error "Zip smoke test FAILED: expected version '$version' in output '$output'" + if ($output -notmatch "^qtmesh\s+$([regex]::Escape($version))$") { + Write-Error "Zip smoke test FAILED: expected exact output 'qtmesh $version', got '$output'" exit 1 }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/deploy.yml around lines 345 - 363, The zip smoke-test currently only checks if $version appears anywhere in $output, which can yield false positives; update the assertion in the Powershell step that runs $exe --version to verify the full expected output shape (for example construct an exact expected string like "qtmesh --version: <version>" or an anchored regex such as "^\s*qtmesh\s+version\s+<version>\s*$" using [regex]::Escape($version)) and compare $output to that expected value (use -eq for exact match or -notmatch with the anchored regex) instead of the current loose -notmatch check on $version. Ensure you reference $exe, $output and $version when building the expected value and fail with the same Write-Error+exit 1 pattern if the strict check does not pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/deploy.yml:
- Around line 345-363: The zip smoke-test currently only checks if $version
appears anywhere in $output, which can yield false positives; update the
assertion in the Powershell step that runs $exe --version to verify the full
expected output shape (for example construct an exact expected string like
"qtmesh --version: <version>" or an anchored regex such as
"^\s*qtmesh\s+version\s+<version>\s*$" using [regex]::Escape($version)) and
compare $output to that expected value (use -eq for exact match or -notmatch
with the anchored regex) instead of the current loose -notmatch check on
$version. Ensure you reference $exe, $output and $version when building the
expected value and fail with the same Write-Error+exit 1 pattern if the strict
check does not pass.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f73c8f79-6ce1-4816-8063-90cb8c9329cb
📒 Files selected for processing (1)
.github/workflows/deploy.yml
|



Summary
qtmesheditor.exe --version,qtmesh.exe --version, and all CLI subcommands produced no output on WindowsQtMeshEditor.exeis built as aWIN32GUI subsystem executable, so it has no console attached by default when launched from PowerShell or cmd. EverycliWrite()call silently dropped outputmain.cpp, when CLI mode is detected on Windows, callAttachConsole(ATTACH_PARENT_PROCESS)+freopen("CONOUT$", ...)beforeCLIPipeline::run()to re-attach to the parent process's console and wire the C runtime stdio streams to itThis fixes the WinGet manual validation failure where the moderator reported that
qtmesheditor.exe --versionandqtmesh.exe --versionproduced no output.Test plan
qtmesheditor.exe --versionfrom PowerShell — should printqtmesh 2.17.1qtmesh.exe --versionfrom PowerShell — should printqtmesh 2.17.1qtmesh.exe info model.fbx— should print mesh info to terminalqtmesheditor.exewithout flags — GUI should open normally (unaffected)🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Bug Fixes
Tests