This is a classic buffering issue in Linux pipelines. The problem occurs because pv is writing to a pipe, and by default, pipes are fully buffered (typically 64KB or more). Since /dev/zero is an infinite stream, pv keeps filling the buffer without flushing, so you don't see any progress until the buffer is full or the process is interrupted.
pv to use line bufferingUse the --line-mode (-l) flag to make pv flush its output after each line (or block, depending on your version). This is the simplest and most reliable fix:
bashdiff <(pv -l /dev/zero) /dev/zero
stdbuf to override bufferingIf pv doesn't support --line-mode or you want more control, use stdbuf to force line buffering for pv:
bashdiff <(stdbuf -oL pv /dev/zero) /dev/zero
-oL sets line buffering for stdout.unbuffer (from expect)If stdbuf is unavailable (e.g., on older systems), install expect and use unbuffer:
bashdiff <(unbuffer pv /dev/zero) /dev/zero
socat as a buffer flusherIf you have socat installed, you can use it to force unbuffered output:
bashdiff <(pv /dev/zero | socat -u - STDIO) /dev/zero
-u disables buffering in socat.pv inherits the buffering behavior of the pipe.diff reads both inputs in chunks, so pv's output is stuck in the buffer until diff reads it or the buffer fills up.-l or stdbuf -oL) ensures pv flushes its output frequently, so you see progress in real time.Try the first solution (pv -l) first—it’s the cleanest and most portable. Let me know if you need further adjustments!
Vibe can make mistakes. Check answers. Learn more