Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Make TTY raw-mode changes fallible and restore terminal state

Aperta
#442 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
rust

Direzione di ricerca

Inizia con le funzioni host TTY in src/lib.rs:1999-2007 e i tipi pubblici in platform/Tty.roc:13-18, quindi esamina la chiamata a roc_main in src/lib.rs:2112-2124. Definisci la proprietà e il comportamento in caso di errore per le operazioni ripetute in modalità raw e usa test di integrazione PTY per verificare il ripristino dopo ritorni normali, errori dell’applicazione e il percorso crash/expect di Roc supportato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Rust
Stelle
121
Fork
45
Merge medio
19h 1m
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di roc-lang/basic-cli

Tutte le issue di roc-lang/basic-cli

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.