Skip to content

feat(console): AttachParentConsole for Windows GUI exes - #28

Merged
Snider merged 2 commits into
mainfrom
feat/attach-parent-console
Nov 24, 2026
Merged

Snider merged 2 commits into
mainfrom
feat/attach-parent-console

Conversation

@Snider

@Snider Snider commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

core.AttachParentConsole(): a Windows GUI exe (-H windowsgui) borrows the console of the terminal that ran it, so its commands print. Output that's already redirected (file, pipe, SSH) is kept, which is what the app-local copies in Pinku and GrootDPS got wrong. No-op elsewhere.

Tests: Good (redirected stdout is kept) and Ugly (repeat call), plus an example. Linux CI here; also run natively on Windows 11.

🤖 Generated with Claude Code
Co-Authored-By: Virgil virgil@lethean.io

Summary by CodeRabbit

  • New Features
    • On Windows, applications can now connect their output and logs to a parent console when one is available. Standard output, standard error and logging are redirected to that console after a successful connection.
    • If output is already connected, or a parent console cannot be attached, existing output remains unchanged. On non-Windows platforms, the operation reports that no console was attached.

An app built -H windowsgui has no stdout when one of its commands is run
from cmd or PowerShell. AttachParentConsole borrows the terminal's console,
and leaves output that's already redirected (a file, a pipe, SSH) alone.
A no-op outside Windows. Replaces the copies in Pinku and GrootDPS, where
the redirect case was broken.

Co-Authored-By: Virgil <virgil@lethean.io>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The change adds AttachParentConsole for Windows and non-Windows builds. On Windows, it can attach to the parent console and redirect stdout, stderr and logger output. Tests and an example cover the function’s results.

Changes: Parent console attachment

Layer / File(s) Summary
Platform implementations
console_windows.go, console_other.go
The Windows implementation preserves valid stdout, attempts to attach to the parent console and redirects stdout, stderr and logger output after successful attachment. The non-Windows implementation returns Value: false and OK: true.
Tests and example
console_test.go, console_example_test.go
Tests check the result, unchanged stdout and repeated calls. The example prints the result fields.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

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

…riplets

Co-Authored-By: Virgil <virgil@lethean.io>
@Snider
Snider merged commit 9d32150 into main Nov 24, 2026
1 check passed
@Snider
Snider deleted the feat/attach-parent-console branch November 24, 2026 13:07
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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