This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stdbuf does not work


Dear Eliot,
Thanks for getting back so quickly.Program1 is a windows routine, xgraph.  http://www.xgraph.org/ms/index.htmlThis is a general purpose plotting program which writes out text whenever an operation is performed in its graphic window.
That text output is piped into Program2, a home-grown tcsh script.Program2 reads the xgraph text output one line at a time and uses it to update the display list files which xgraph is polling to keep its graphic window up to date.
Here is the test harness I'm executing inside a cygwin window. For test purposes, Program2 is cat.   stdbuf -oL -eL xgraph | cat -A
Here's a typical output which is only seen once I've terminated xgraph by clicking the appropriate button in the graphic window. The only think I did while xgraph was running was click at one location in the graphics window; that's what generated the line: Clicked at (x,y) = (-0.62324, 0.255608)
XGraph v4.38^M$Window (800 x 594)^M$0 points read.^M$^M$Error:  No dimensional data was read.  Cannot determine axes ranges.^M$^M$   Clicked at (x,y) = (-0.62324, 0.255608)^M$Exiting XGraph.^M$
I tried 0 (zero) instead of L in the stdbuf switches just because.I also tried using stdbuf -i0 Program2in case that might make a difference.
I can easily eliminate the <cr>:  stdbuf -oL -eL xgraph | tr -d "\015" | cat -AThis produces the same output but with the ^M 's removed.I don't know how to alter the windows line endings but would like to.
Thanks again and for any further thoughts.
Best - Don

      From: Eliot Moss <moss@cs.umass.edu>
 To: cygwin@cygwin.com 
 Sent: Saturday, August 18, 2018 9:14 AM
 Subject: Re: stdbuf does not work
   
On 8/18/2018 8:36 AM, Donald Krieger via cygwin wrote:
> Dear list,
> I require line buffered output from program1 and line buffered input to program2.The following works under Linux but not under Cygwin.   stdbuf -oL -eL program 1 |& program2
> 
> I've searched the archive without success.I have tried -o0 -e0 -i0 and have also tried
>    stdbuf -oL -eL program1 |& stdbuf -i0 program2
> I have a fresh installation of cygwin as of a few months ago:  uname -a              yields:CYGWIN_NT-10.0 DESKTOP-S92525R 2.10.0(0.325/5/3) 2018-02-02 15:16 x86_64 Cygwin
>    stdbuf --version    yields:stdbuf (GNU coreutils) 8.26Packaged by Cygwin (8.26-2)Copyright (C) 2016 Free Software Foundation, Inc....

Some thoughts to consider:

- -i0 means unbuffered; did you write the wrong description above?
- As noted in the strbuf man page, some programs don't use streams and thus are
  not affected by strbuf settings.  I agree this is not something likely to
  change for the same program ported from Linux to Cygwin.
- How do you have line endings set up on Cygwin or in any files you are
  processing?  The usual Windows line ending  being CR-LF instead of Linux's
  LF can confuse some programs.

It might also help potential responders to know a little more about what program1 and
program2 are.  Are they Windows or Cygwin programs?

Regards - EM

--
Problem reports:      http://cygwin.com/problems.html
FAQ:                  http://cygwin.com/faq/
Documentation:        http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



   

|  | Virus-free. www.avast.com  |


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]