Sample Header Ad - 728x90

How to turn off stdout buffering in a pipe?

556 votes
15 answers
339358 views
I have a script which calls two commands: long_running_command | print_progress The long_running_command prints progress but I'm unhappy with it. I'm using print_progress to make it nicer (namely, I print the progress in a single line). **The problem:** Connection a pipe to stdout also activates a 4K buffer, so the nice print program gets nothing ... nothing ... nothing ... *a whole lot* ... :) How can I disable the 4K buffer for the long_running_command (no, I do not have the source)?
Asked by Aaron Digulla (6288 rep)
Jun 16, 2009, 10:27 AM
Last activity: Jan 11, 2024, 06:39 PM