Skip to content

fix: 初始化 shell_started 标志以防止标签页静默消失 - #516

Closed
LuoYe17 wants to merge 2 commits into
Kuddev:mainfrom
LuoYe17:fix/issue-512-shell-startup-detection
Closed

LuoYe17 wants to merge 2 commits into
Kuddev:mainfrom
LuoYe17:fix/issue-512-shell-startup-detection

Conversation

@LuoYe17

@LuoYe17 LuoYe17 commented Oct 7, 2026

Copy link
Copy Markdown

修复 #512

问题

当 shell 启动失败时(例如卸载了 WSL 发行版或 PowerShell 缺失),终端窗格会静默消失,因为现有逻辑无法区分启动失败和正常退出。

解决方案

shell_started 标志已经在 view.rs 中定义,其状态机逻辑也已完整实现:

  • 收到第一个 Wakeup 事件时置为 true(shell 产生了输出)
  • mark_exited 中检查该标志,决定发出 Exited 还是 StartupFailed 事件
  • StartupFailed 事件处理器保留窗格并显示错误提示

但是 startup.rs 中的构造函数遗漏了初始化,导致标志始终未初始化。

本 PR 添加了缺失的初始化(shell_started: false),让状态机按设计工作。

测试

架构检查器通过。格式检查器显示整个代码库已存在的 CRLF 问题(非本次改动引入)。

Fixes Kuddev#512

When a shell fails to start (e.g., uninstalled WSL distro or missing
PowerShell), the terminal pane would silently disappear because the
existing logic could not distinguish startup failures from normal exits.

The shell_started flag was defined in view.rs and its state machine was
already implemented (set to true on first Wakeup event, checked in
mark_exited to emit either Exited or StartupFailed event), but the
constructor in startup.rs missed the initialization.

This commit adds the missing initialization (shell_started: false) so
the state machine works as designed: failed shells now trigger
StartupFailed events that preserve the pane and show an error toast
instead of silently closing.
@LuoYe17
LuoYe17 requested a review from Kuddev as a code owner October 7, 2026 09:53
@LuoYe17 LuoYe17 closed this Oct 10, 2026
@LuoYe17
LuoYe17 deleted the fix/issue-512-shell-startup-detection branch October 10, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant