Make TTY raw-mode changes fallible and restore terminal state
維護者通常 1 天內回覆
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- rust
- 領域
- cli, operating-systems
研究方向
先從 src/lib.rs:1999-2007 中的 TTY 主機函式和 platform/Tty.roc:13-18 中的公開型別著手,然後檢查 src/lib.rs:2112-2124 中的 roc_main 呼叫。定義重複執行 raw-mode 操作時的所有權與錯誤行為,並使用 PTY 整合測試驗證在正常返回、應用程式錯誤以及受支援的 Roc crash/expect 路徑之後是否恢復。
由索引模型根據 Issue 內容生成。
描述
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_mainfor 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.
- 主要語言
- Rust
- 星號
- 123
- 分支
- 46
- 平均合併
- 7 小時 43 分鐘
- 30 天內合併 PR
- 16
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
roc-lang/basic-cli 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 66/100
roc-lang/basic-cli#537 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 55/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 25/100
roc-lang/basic-cli#482 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 45/100
維護者通常 1 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 45/100
roc-lang/basic-cli#455 · 1 則留言 ·
維護者通常 1 天內回覆
查看 roc-lang/basic-cli 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 84/100
dekobon/big-code-analysis#1729 ·
維護者通常 1 天內回覆
-
bug help wanted
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
akitaonrails/ai-memory#1888 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
peteonrails/voxtype#941 ·
維護者通常 4 天內回覆
-
bug priority:medium triage:maintainable
難度 2/5 1-3 小時 新手友好度 82/100
ccusage/ccusage#2000 · 3 則留言 ·
維護者通常 1 天內回覆