tee piping to head gives error message

Buchbinder, Barry (NIH/NIAID) BBuchbinder@niaid.nih.gov
Mon Feb 7 19:33:00 GMT 2005


As described in the Subject.  Though it seems that everything works OK; tee
just gives and error message under some circumstances.


/tmp> cat stafflist.htm | tee ttt | head > /dev/null
tee: standard output: Broken pipe
tee: write error
/tmp> wc ttt
  556  1738 21441 ttt
/tmp> wc stafflist.htm
  556  1738 21441 stafflist.htm
/tmp> cmp stafflist.htm ttt
/tmp>


So the file that tee write looks good and the write error is only to the
pipe.


tee: standard output: Broken pipe
     10      38     484
tee: write error
/tmp> cat stafflist.htm | tee ttt | head -50 | wc
tee:      50     167    1832
standard output: Broken pipe
tee: write error
/tmp> cat stafflist.htm | tee ttt | head -125 | wc
tee: standard output: Broken pipe    125     343    4103

tee: write error
/tmp> cat stafflist.htm | tee ttt | head -50 | wc
tee: standard output: Broken pipe     50     167    1832

tee: write error
/tmp> cat stafflist.htm | tee ttt | head | wc
tee: standard output: Broken pipe
     10      38     484
tee: write error
/tmp> cat stafflist.htm | tee ttt | head -126 | wc
tee: standard output: Broken pipe    126     345    4121

tee: write error
/tmp> cat stafflist.htm | tee ttt | head -127 | wc
tee: standard output: Broken pipe    127     349    4153

tee: write error
/tmp> cat stafflist.htm | tee ttt | head -130 | wc
    130     359    4309
1 /tmp> cat stafflist.htm | tee ttt | head -800 | wc
    556    1738   21441
/tmp>


So head seems to be passing on the number of lines that ones asks it to pass
on.


/tmp> cat stafflist.htm | tee ttt | tail > /dev/null
/tmp> cat stafflist.htm | tee ttt | tac > /dev/null
/tmp> cat stafflist.htm | tee ttt | cat > /dev/null
/tmp> cat stafflist.htm | tee ttt | sed -e 's/^/-/' > /dev/null
/tmp> cat stafflist.htm | tee ttt | wc > /dev/null
/tmp> cat stafflist.htm | tee ttt | head > /dev/null
tee: standard output: Broken pipe
tee: write error
/tmp> cat stafflist.htm | head > /dev/null
/tmp> cmp stafflist.htm ttt
/tmp>


So it seems to be specific to piping from tee to head.


/tmp> wc stafflist.htm
  556  1738 21441 stafflist.htm
/tmp> cat stafflist.htm | tee ttt | head -50 > /dev/null
tee: standard output: Broken pipe
tee: write error
/tmp> cat stafflist.htm | tee ttt | head -120 > /dev/null
tee: standard output: Broken pipe
tee: write error/tmp>
/tmp> cat stafflist.htm | tee ttt | head -125 > /dev/null
tee: standard output: Broken pipe
tee: write error
/tmp> cat stafflist.htm | tee ttt | head -126 > /dev/null
/tmp> cat stafflist.htm | tee ttt | head -130 > /dev/null
/tmp>


So it seems that when given enough lines/bytes, there is no error message.
But the number of lines/bytes at which the error disappears does not seem to
be constant.


Everything should be up to date.  cygcheck.out is attached.


- Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 24288 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050207/448b82b9/attachment.obj>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list