Eli Fulkerson .com HomeProjectsHold
 

hold

Description:

"hold" is a console program that buffer pipes input, holding stdin until it is closed then dumping the whole bucket to stdout at once.

This was written because I was having trouble using Windows based command line utilities under cygwin. In particular, if I was trying to parse the output of "tracert" via a second program using Console.Readline() the second program's input would give up and die as soon as tracert delayed.

An extremely cursory and shallow bit of research later, apparently there is a difference between how Cygwin and Windows buffer their input, in particular (although I haven't verified this) null writes being sent on stdout. Under Cygwin the programs talk to eachother directly, the null write is interpreted as EOF, and BOOM. Under Windows, apparently, there is some sort of other layer that appears between them and causes this to not happen correctly.

Reference: https://cygwin.com/ml/cygwin/2012-04/msg00613.html

... that being said, I really only did a cursory skim. That discussion appears to be similar but not identical to the difficulties I had, seemed plausible and seemed unlikely to result in a fix.

Action Shot:


$cat /dev/random |hold
hold: delaying 3775296 bytes.

License:

GPLv3

Download:

hold.exe for Cygwin - This requires Cygwin. I'm not currently planning to port it to native Win32.

hold for Linux: g++ -o hold hold.cpp

hold for OSX: g++ -o hold hold.cpp

source - hold.cpp