Re: tee command incompatible with xterm
Re: tee command incompatible with xterm
- Subject: Re: tee command incompatible with xterm
- From: Cameron Simpson <email@hidden>
- Date: Sun, 04 Dec 2011 09:27:15 +1100
On 02Dec2011 22:12, Marquette Jean-Baptiste <email@hidden> wrote:
| Le 2 déc. 2011 à 21:08, email@hidden a écrit :
| > why use a tee command from within an xterm given xterm itself can
| > send a copy of all its output to a log file?
|
|
| Because I didn't know that option! I modified my command to use -l -lf,
| and the results are far better¿
Just as a remark, Jean-Baptiste is probably being bitten by buffering.
Tee itself is unbuffered because it is made to sit in pipelines to copy
data as it happens. However, most commands buffer their output (stdout;
stderr by convention is unbuffered in order to see error messages
promptly).
When output is a terminal the stdio package line buffers by default,
producing human friendly behaviour. But other, output is _block_
buffered, and only sent when the buffer is full (eg every 8192 bytes).
When you run a command in an xterm like this:
foo
its output is connected to the terminal provided by xterm, and line
buffering takes place.
When you run this:
foo | tee bah
the output of "foo" is not a terminal, and it block buffered.
"tee" is copying data immediately, but "foo" is only sending it when the
buffer fills, not when a line fills.
But dropping "tee" and using xterm's logging facility you are causing
"foo" to have a terminal again. But if your command was like this:
foo | bah
foo would again be block buffering, even if you were using xterm's
logging stuff.
Just so you all realise _why_ you see what you see,
--
Cameron Simpson <email@hidden> DoD#743
http://www.cskk.ezoshosting.com/cs/
DRM doesn't inconvenience pirates ¿ indeed, over time it trains
law-abiding users to become pirates out of sheer frustration.
- Charles Stross
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden