Commit graph

10 commits

Author SHA1 Message Date
Kamron Batman
9cced198f9 fix(console): restore pump error logging; drop unused Stop; stop invalidating help cache on lookup
- ConsoleInputPump gains an optional ILogger so the reader-fault and
  command-dispatch catch blocks log warnings/errors again, matching the
  behavior the old ConsoleInputHandler had before the pump refactor.
- Remove ConsoleInputPump.Stop() — dead code, nothing calls it; the reader
  thread already terminates on EOF/Core.Closing/finally cleanup.
- GetInputCommand no longer clears the help-description cache on every
  lookup; RegisterCommand/UnregisterInputCommand still invalidate it
  correctly on the paths that actually change the command set.
2026-07-15 23:32:06 -07:00
Kamron Batman
cd62856767 refactor(console): headless-aware facade over ConsoleInputPump; remove async-void handshake
ConsoleInputHandler.Initialize() now checks Core.Headless and skips
starting the input thread entirely when stdin isn't a TTY, logging
instead. When not headless, it delegates the read loop to
ConsoleInputPump (Task 2) rather than running its own async void
loop with a two-AutoResetEvent handshake.

ReadLine() throws HeadlessConsoleInputException when headless, falls
back to a direct Console.ReadLine() during early startup or after the
pump loop has ended, and otherwise blocks on the pump.
2026-07-15 23:32:06 -07:00
Kamron Batman
2d4500bf40 fix(console): make ConsoleInputPump cleanup unconditional; document single-caller contract
Wrap the Run() loop in try/finally so cleanup (_running = false;
ReleasePendingPrompt(null)) always executes, even if the injected
lookup throws. Previously a throwing lookup escaped the loop and left
any pending ReadLine() caller blocked forever. Also fold the lookup
call into the same try/catch as the handler invocation so a bad
command is swallowed without tearing down the reader loop.

Document via XML comments that ReadLine() supports a single sequential
caller (not concurrent callers) and that command handlers dispatched
by Run() execute on the reader thread and must not call ReadLine().

Add a regression test proving a throwing lookup neither hangs a
pending prompt nor kills the reader loop. Also drop an unused
System.Text using from the test file.
2026-07-15 23:32:06 -07:00
Kamron Batman
c6c212d78f feat(console): add testable ConsoleInputPump rendezvous with EOF handling 2026-07-15 23:32:06 -07:00
Kamron Batman
a423905c6f feat(console): add Core.Headless flag and guard the exit-pause prompt 2026-07-15 23:32:06 -07:00
Kamron Batman
e1e1a7c640
fix: Bumps deps. Updates copyrights (#2353) 2026-03-05 19:36:54 -08:00
Kamron Batman
1f8ab0e783
fix: Console Input is disabled on Linux when no standard input is attached. (#1809) 2024-06-06 21:20:22 -07:00
Daniel Dias Rodrigues
e85c56ec2d
fix: Fix ConsoleInput for Linux users with try/catch. (#1803) 2024-05-30 14:03:28 -07:00
Kamron Batman
912eaab460
fix: Fixes unresponsive console input (#1720)
### Summary
Fixes an issue where the call priority of `Initialize` functions causes a dead lock because the console input handler was not initialized.
2024-04-05 15:07:43 -07:00
Kamron Batman
e638fb7893
feat: Adds console commands (#1714)
### Summary
* Adds console command support.
* Adds `save`, `restart`, and `shutdown` commands.
2024-03-30 09:40:43 -07:00