Skip to content

Read the status line of a console run through StatusReport.Read [patch] - #83

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/console-status-getter-throws-79
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/console-status-getter-throws-79

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #79

What was wrong

ConsoleRunner.DescribeRun built the startup line from app.Describe(), and Describe() calls the tool's Status getter with no guard. When the getter threw, the exception left Run after the finally had run OnStop. It then left TrayAppBuilder.RunAsync, so the process died with exit 134. That breaks the 0/1/2 exit-code contract. The tray-to-terminal fallback goes through the same path. That fallback is used when a helper is missing, which is also when a getter is most likely to throw.

Change

When the tool has a Status getter, DescribeRun now reads it through StatusReport.Read, the same non-fatal guard --status uses (#62/#64). A throwing getter gives demo: error: <message>, stopping after …. Press Ctrl+C to stop. The run then continues and stops with its normal exit code. Tools without a getter still get <DisplayName> is running from Describe().

Tests

  • Run_WhenTheRunItselfThrows_StillStops expected the exception to propagate. As the issue suggests, it is replaced by Run_WhenTheStatusThrows_ReportsItAndStillRunsAndStops. The new test checks four things: exit code 0, OnStop ran, the error: the status broke line, and demo: stopped.
  • With the ConsoleRunner change reverted, the new test fails.
  • Full suite on Linux / .NET 10: 191 passed, 1 skipped.

Generated by Claude Code

ConsoleRunner.DescribeRun called the tool's Status getter bare, so a getter
that threw (likely in exactly the environment that sends a tray run to the
console fallback) escaped Run and TrayAppBuilder.RunAsync and ended the process
with exit 134. It is now read the way --status reads it: the run prints
"<name>: error: <message>", keeps running, and stops with its normal exit code.

Fixes #79

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW31r4TeF4cogSkLxEi
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

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.

A console run (incl. the tray→terminal fallback) aborts with exit 134 when the tool's Status getter throws

2 participants