Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Make TTY raw-mode changes fallible and restore terminal state

Geschlossen
#442 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@lukewilliamboswell arbeitet bereits daran.

Seit 12.10.2026.

  • #515 von @lukewilliamboswell — gemerged

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
rust

Rechercherichtung

Beginne mit den TTY-Hostfunktionen in src/lib.rs:1999-2007 und den öffentlichen Typen in platform/Tty.roc:13-18 und untersuche anschließend den roc_main-Aufruf in src/lib.rs:2112-2124. Lege Besitz- und Fehlerverhalten für wiederholte Raw-Mode-Operationen fest und verwende PTY-Integrationstests, um die Wiederherstellung nach normalen Rückgaben, Anwendungsfehlern und dem unterstützten Roc-crash/expect-Pfad zu überprüfen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Context

Both TTY host functions discard the result returned by crossterm:

  • src/lib.rs:1999-2007

The public functions are therefore typed as infallible in platform/Tty.roc:13-18, even when stdin is not a terminal or the OS rejects the operation.

The host also does not visibly track whether it enabled raw mode or guarantee restoration when the Roc application returns an error or crashes. #69 previously tracked panic restoration and was closed, but the current implementation still ignores errors and calls roc_main without a raw-mode cleanup guard at src/lib.rs:2112-2124.

Suggested direction

  • Return a typed error from enable/disable operations.
  • Track raw-mode ownership so the host only restores a mode it enabled.
  • Install cleanup around roc_main for normal return and Roc crash/expect paths.
  • Document what can and cannot be guaranteed for external termination signals.

A small RAII guard in the Rust host may make the normal and unwinding paths easier to reason about, although the release profile uses panic = "abort" and therefore also needs explicit crash-handler consideration.

Acceptance criteria

  • Enabling or disabling raw mode reports OS errors to Roc.
  • Raw mode is restored after normal success and application-level error returns.
  • Raw mode restoration is tested for the Roc crash/expect path supported by the host.
  • Repeated enable/disable calls have defined behavior.
  • PTY integration tests verify the terminal state after the child exits.
Vorherrschende Sprache
Rust
Sterne
122
Forks
47
Ø Merge
12 Std. 20 Min.
Gemergte PRs (30 T.)
18

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus roc-lang/basic-cli

Alle Issues in roc-lang/basic-cli

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.