Skip to content

Show a numbered menu on Linux and macOS instead of crashing - #175

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/161-menu-on-unix
Oct 7, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/161-menu-on-unix

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #161

What changed

  • Menu.Run still uses the DustInTheWind ScrollMenu, but only in an interactive Windows console (OperatingSystem.IsWindows() && !Console.IsInputRedirected). Everywhere else, the menu is a numbered prompt that reads one line at a time:
    • typing a number runs that verb, then the menu is shown again
    • 0, or reaching the end of input, exits with code 0
    • anything else prints Not an option: <input>
  • The scroll menu now has an Exit item. It calls ControlRepeater.RequestClose(), so leaving no longer needs Ctrl+C.
  • README: one paragraph saying which menu each platform gets.

Verification

  • New MenuTests drive the numbered prompt through redirected stdin:
    • it lists the verbs and exits on 0
    • it exits at end of input
    • it runs Scan from a menu choice and shows the menu again
    • it rejects an option that isn't on the menu
  • With Menu.cs reverted, all four tests fail with the PlatformNotSupportedException from the issue. With the fix, the full suite passes locally on Linux: 83 passed, 3 skipped. The 3 skips already existed and need a non-root user.
  • On Linux, the built binary with no arguments and 0 piped in now prints the numbered menu and exits 0. Before the fix it aborted with exit code 134.
  • I have not run the Windows scroll-menu path, including the new Exit item. It needs a Windows console.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL


Generated by Claude Code

claude added 2 commits October 7, 2026 00:27
Running with no arguments opened a DustInTheWind ScrollMenu, which reads
Console.CursorVisible. That getter throws PlatformNotSupportedException on
every platform but Windows, so the documented default entry point crashed
with exit code 134 on Linux and macOS. The scrolling menu is now kept for
an interactive Windows console, and everywhere else the menu is a numbered
prompt read a line at a time. Both have an Exit item, and the numbered
prompt also exits at the end of input.

Fixes #161

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EMKbHPuiquQwvUr7NBWPvL
Only the loop that displays the menu needs an interactive Windows console.
Building the menu and its Exit command does not, so a test now covers both.

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

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 1b6157d into main Oct 7, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the fix/161-menu-on-unix branch October 7, 2026 05:35
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.

Running with no arguments crashes on Linux and macOS with PlatformNotSupportedException instead of showing the interactive menu

2 participants