Skip to content

capture_output error path drops Child without kill/wait (zombie on Unix) #400

Description

@Finesssee

Source

Flagged during the thermo-nuclear review of #398 / #399 in rust/src/host/command_runner.rs.

Problem

In CommandRunner::run() (~line 159), capture_output is invoked via ? on the stdout/stderr reader handles. If this errors, run propagates the error immediately and the Child is dropped without kill() or wait() being called — on Unix this leaves an unreaped zombie process until the parent exits.

This is a sibling of the error path fixed in #399 (where finish_child's Err arm fell through to teardown). The finish_child function itself is now correct on all paths; the remaining gap is the early ? in run() that bypasses finish_child entirely.

Suggested fix

Wrap the capture_output call so that on error, the child is torn down (kill + wait) before propagating — e.g. match capture_output(...) { Ok(v) => v, Err(e) => { finish_child(&mut child); return Err(e); } } or an equivalent guard.

Context

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