Skip to content

[Bug] 使用 ! 命令模式时异常退出(ls | grep Agent 返回 exit code 1) #2004

Description

@notfresh

问题描述

在使用 ! 命令模式执行 shell 命令时,命令会被判定为失败并异常退出。

复现步骤

1. 进入命令模式,执行:
   ```bash
   ! ls | grep Agent
  1. 观察执行结果。

实际结果

输出如下,并提示失败退出:

$ ls | grep Agent
Process exited with code 1
Command failed with exit code: 1.

预期结果

  • grep 未匹配到内容导致返回码为 1 时,不应被当作“异常”处理并中断流程。
  • 或者至少应给出更清晰提示:这是“无匹配结果”而非命令执行错误。

影响

影响在 ! 模式下进行常见管道查询(尤其是 grep)的可用性与用户体验,容易误判为程序异常。

环境信息

  • Repo: MoonshotAI/kimi-code
  • 触发命令: ls | grep Agent
  • 时间: 2026-07-21(本地)

备注

grep 在无匹配时返回 1 属于常见行为,建议在 ! 命令模式中对该类返回码做兼容处理,或提供可配置的退出码策略。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions