drainpipe

Crates.iodrainpipe
lib.rsdrainpipe
version0.1.0
created_at2025-09-23 19:34:49.602964+00
updated_at2025-09-23 19:34:49.602964+00
descriptionBuffer a stream and flush the tail on exit (lines/time/bytes), with passthrough and signal handling.
homepage
repository
max_upload_size
id1851990
size30,345
Libor Wagner (liborw)

documentation

README

drainpipe

A small Rust CLI that buffers stdin and flushes the tail on exit.

Features

  • Limit policies: by lines (-n), time window (-t), or total bytes (-b)
  • Optional live passthrough of input (-p)
  • Output target on flush: stdout, stderr, or file (-o)
  • Signal handling: graceful on SIGINT/SIGTERM/SIGHUP/SIGPIPE; double Ctrl-C exits with 130
  • Optional timestamp prefix when flushing (--prefix-time[=<fmt>])
  • Max line size with truncation (--max-line-bytes, --truncate-suffix)

Build

cargo build --release

Examples

cat log.txt | target/release/drainpipe -n 200
myproc | target/release/drainpipe -t 10s -p
myproc | target/release/drainpipe -b 1M -o out.txt --prefix-time
Commit count: 0

cargo fmt