From: nobu.nokada@... Date: 2002-09-19T12:53:08+09:00 Subject: Re: Capturing stdout from cmd while letting it print it Hi, At Wed, 18 Sep 2002 17:55:43 +0900, coma_killen@fastmail.fm wrote: > > "mycmd" may buffer and not flush the output. How large is the > > output? > > > mycmd is really a checksum verification program that goes through > all the files in the dir. It prints and updates a percentage of > how much of each file has been verified, as it verifies the file. > > Output is as many lines as there are files in the dir. > Thus, not very large. Standard C runtime libraries buffers output to IO descriptor othar than tty, in order to improve throughput. Since pipes are subjects of this behavior, data will not passed to consuming process until producing process flushes the buffer or data size reaches the limit (perhaps 4k or 8k, defined as BUFSIZ in stdio.h). Some commands have unbuffering option to get rid of it. This issue will occur with "tee" command David Stagner mentioned. > > Or, it may send output to stderr or console instead of stdout. > > > Could be but not likely. How can i check this? Redirection. mycmd > log directs only stdout from "mycmd" to file "log". And if the command takes minuets, you may be possible to observe that the log size doesn't increase continuously. -- Nobu Nakada