Jeff Abrahamson on 31 Oct 2006 20:29:31 -0000 |
That's not true, Morgan. It's actually very important for pipes that they not buffer too much. Writes by program1 may even block pending program2 reading. You can see this by typing "yes | sleep 3600". In another window, type "ps ax | grep yes" to find yes's process number, and then type "strace -p pid" (where "pid" is the process id of yes). You'll see that it's stuck on a write command. -Jeff On Tue, Oct 31, 2006 at 03:15:29PM -0500, Morgan wrote: > [45 lines, 182 words, 1434 characters] Top characters: _nitsoel > > Ben, > > Unless I am misunderstanding your question, this is just basic UNIX > plumbing: the program being piped to will not even start I don't > think until the first is finished. > > -morgan > > Ben Dugan wrote: > > > > I'm confused by what is probably normal behavior: > > > > > > [~]# program1 | program2 > > > > > > I don't get any output (on stdout) from program2 until program1 > > finishes. (I'm trying this out with simple C programs; program1 > > does a printf once every second, while program2 just watches stdin > > using fscanf and copies its stdin to stdout.) > > > > I've been googling and looking at some reference books I have, but > > I can't really figure out why this is. I can't coerce program2's > > output to happen sooner using flush, either. -- Jeff Jeff Abrahamson <http://jeff.purple.com/> +1 215/837-2287 GPG fingerprint: 1A1A BA95 D082 A558 A276 63C6 16BF 8C4C 0D1D AE4B Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|