Miserlou / Miserlou/Loop

Pipe closing isn't handled gracefully

Open
#20 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
697
Forks
28
PR merge metrics
No merged PRs in 30d

Description

When loop is piped to some program that only takes a subset of loop's output the program prints throws a panic message that may confuse people when used as part of a long command chain.

Example:

user@pc $ loop 'echo $COUNT' | head -n 2
0
1
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', libstd/io/stdio.rs:692:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

The expected behaviour is that loop exits gracefully upon detecting the pipe is closed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported command, loop 'echo $COUNT' | head -n 2, and inspect the code that writes loop output to stdout. The work is done when the command exits gracefully without printing a broken-pipe panic or backtrace message.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.