Make TTY raw-mode changes fallible and restore terminal state
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 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
- 星标
- 121
- 派生
- 46
- 平均合并
- 20 小时 53 分钟
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
roc-lang/basic-cli 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
维护者通常 1 天内回复
查看 roc-lang/basic-cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
rescript-lang/rescript#8765 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
farion1231/cc-switch#8072 ·
维护者通常 1 天内回复
-
Python 3.15 support可能已有人在做 @amnesiaof 今天认领。 未关闭L: python L: python:uv
难度 2/5 1-3 小时 新手友好度 72/100
dependabot/dependabot-core#16524 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
chroma-core/chroma#7879 ·
维护者通常 1 天内回复