Skip to content

Fix Windows CLI output (attach console for GUI subsystem exe) — v2.17.1 - #230

Merged
fernandotonon merged 3 commits into
masterfrom
feature/improve-merge-animations
Mar 28, 2026
Merged

Fix Windows CLI output (attach console for GUI subsystem exe) — v2.17.1#230
fernandotonon merged 3 commits into
masterfrom
feature/improve-merge-animations

Conversation

@fernandotonon

@fernandotonon fernandotonon commented Mar 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bug: qtmesheditor.exe --version, qtmesh.exe --version, and all CLI subcommands produced no output on Windows
  • Root cause: QtMeshEditor.exe is built as a WIN32 GUI subsystem executable, so it has no console attached by default when launched from PowerShell or cmd. Every cliWrite() call silently dropped output
  • Fix: In main.cpp, when CLI mode is detected on Windows, call AttachConsole(ATTACH_PARENT_PROCESS) + freopen("CONOUT$", ...) before CLIPipeline::run() to re-attach to the parent process's console and wire the C runtime stdio streams to it
  • Bumps version to 2.17.1

This fixes the WinGet manual validation failure where the moderator reported that qtmesheditor.exe --version and qtmesh.exe --version produced no output.

Test plan

  • Build on Windows (MinGW)
  • Run qtmesheditor.exe --version from PowerShell — should print qtmesh 2.17.1
  • Run qtmesh.exe --version from PowerShell — should print qtmesh 2.17.1
  • Run qtmesh.exe info model.fbx — should print mesh info to terminal
  • Launch qtmesheditor.exe without flags — GUI should open normally (unaffected)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Version bumped to 2.17.1
  • Bug Fixes

    • Restored correct CLI output redirection on Windows
  • Tests

    • Added Windows release smoke-tests to verify the packaged CLI reports the expected version

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>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Mar 28, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Project 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

Cohort / File(s) Summary
Version Update
CMakeLists.txt
Bumped project version from 2.17.02.17.1, propagating ${PROJECT_VERSION} to related defines and variables.
Windows CLI Console Handling
src/main.cpp
Added Q_OS_WIN-guarded includes and logic to AttachConsole(ATTACH_PARENT_PROCESS) and freopen("CONOUT$", "w", ...) so CLI mode prints to parent console on Windows before CLIPipeline::run.
Release CI Smoke Tests
.github/workflows/deploy.yml
Added Windows-only PowerShell steps to run qtmesh.exe --version from built artifacts and from the release ZIP, failing the job if version output does not match expected release tag.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A tiny hop to two-point-seventeen-one,
I bind the console so the outputs run,
The CI checks the tag, the ZIP, the bin,
A carrot-cheer for builds that smile and spin! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main bug fix—attaching console for Windows GUI subsystem CLI output—and includes the version bump, covering the primary changes in the changeset.
Description check ✅ Passed The description follows the template with clear Summary and Technical Details sections, explains the bug, root cause, and fix, and includes a comprehensive test plan, though bugfix section could be more explicitly formatted.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/improve-merge-animations

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

fernandotonon and others added 2 commits March 28, 2026 00:42
…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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between 62f7093 and d458710.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml

@sonarqubecloud

Copy link
Copy Markdown

@fernandotonon
fernandotonon merged commit 18b6664 into master Mar 28, 2026
18 checks passed
@fernandotonon
fernandotonon deleted the feature/improve-merge-animations branch March 28, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant