Skip to content

cook completions panics with BrokenPipe when piped to head #708

Closed

Description

@drawmeanelephant

Suggested labels: bug, area: cli


Discovery audit finding M11 (medium) — cooklang/cookcli @ 7c2f48b (v0.38.1), audited 2026-10-12. Repro verified (8/8 runs).

Summary

cook completions <shell> | head panics with BrokenPipe (exit 101).

Where

src/completions.rs:26 — clap_complete::generate(args.shell, &mut cmd, BIN_NAME, &mut std::io::stdout()) streams to stdout; clap_complete .expects internally.

Repro

$ cook completions bash | head -1
thread 'main' panicked: failed to write completion file: BrokenPipe
(exit 101)

Expected

The command exits cleanly when the downstream pipe closes (standard CLI behavior).

Actual

Panic, exit 101.

Acceptance criteria (red → green)

  • Red: the repro exits 101 with a BrokenPipe panic.
  • Green: the repro exits without panicking (0 or 141/SIGPIPE are both acceptable).

Verification

Executed repro, 8/8 runs.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions