Recover from completion panics#81
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #81 +/- ##
==========================================
+ Coverage 22.54% 23.18% +0.63%
==========================================
Files 27 27
Lines 2045 2049 +4
==========================================
+ Hits 461 475 +14
+ Misses 1554 1544 -10
Partials 30 30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
readline calls the application-provided Completer on nearly every keystroke, for both menu completion and as-you-type autocomplete (both funnel through commandCompletion). A panic in that user code — a bad completer or transient command-tree state — propagated out of the completion path and crashed the whole interactive shell. Recover around the completer invocation and surface the panic value as a completion message instead, so a single faulty completion degrades into a visible error rather than taking down the process. Because both completion paths share commandCompletion, this one choke point covers them all. This is the readline-side fix for reeflective/console#81, which worked around the crash by recovering in its own completer; downstream callers no longer need to guard their completers against panics.
|
The crash this guards against is better fixed upstream in readline: readline invokes the application Once that lands, this PR can be dropped, or trimmed down to just the |
|
Closing: this is now fixed upstream in readline (reeflective/readline#116, released in readline v1.3.0). readline recovers from panics in the application completer at its own boundary, so console no longer needs to guard its completer. Once console bumps its readline dependency to v1.3.0 the crash is handled for every consumer. If you still want the |
Background
A panic during completion currently escapes the completion path and can bring down an interactive console. Completion is usually triggered while typing, so a single bad completer or transient command-tree state should degrade into a visible completion error instead of crashing the process.
Approach
Tests