Skip to content

[bug] comsub 内后台任务 &+wait 输出不捕获(后台子进程 stdio 走 Inherit 绕过捕获管道)——nvm ls 默认别名行缺失 #169

Closed

Description

@caomengxuan666

来源

#161 修复过程中的所有者切分:N2(source/exec 重定向下函数型 comsub 泄漏)已修(92294b4f);N3 是不同子系统,独立跟踪。

现象

comsub 内的后台任务 + wait 输出不捕获:

OUT="$(for i in 1 2; do job_fn & done; wait)"

输出泄漏到终端、OUT 为空(GNU 完整捕获)。真实破坏:nvm nvm ls 的默认别名行缺失。

根因(已定位)

execute_background_ast_command/resolve_background_stdio(compound_exec.rs:299/:546)把后台任务 spawn 为真实 rubash -c 子进程,stdio 走 Inherit(复制进程 OS 句柄)而非进程内捕获管道——捕获活跃时后台子进程的 stdout 绕过了捕获缓冲。

修复方向

捕获活跃(comsub/pipeline capture context)时给后台子进程 piped stdout,在 wait/完成路径排水回捕获缓冲;需处理多个后台任务共用一个捕获端的排序语义(GNU:内核管道天然合并)。

产物

双侧落盘:target/issue-suites/results/rubash161/(nvm.* 11 行差即本项)

Activity

  1. added
    bug
    on Sep 26, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    已在 de86dd5/9b1eb043 修复并关闭(四个独立 commit + captain darwin pipe2 热修)。验收矩阵与双侧产物见各 commit message 及 worktree target/ 探针;套件切片 trap/comsub/redir/attr/func 均 0 diff;474/474 + 双交叉干净。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions