public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: cygwin@cygwin.com
Subject: Re: stdbuf does not work
Date: Sat, 18 Aug 2018 20:17:00 -0000	[thread overview]
Message-ID: <c0ffc88a-a763-1e34-73cf-6d7592f9ba40@cs.umass.edu> (raw)
In-Reply-To: <625442829.188518.1534601860831@mail.yahoo.com>

On 8/18/2018 10:17 AM, Donald Krieger via cygwin wrote:
> 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.

Apparently stdbuf works by interposing stuff, via a loader PRELOAD technique,
before main in the program being run.  I suspect this simply does not work
when applied to Windows programs, though I cannot say for sure.

What about this:

xgraph ... | strbuf -oL -eL tr -d '\015' | ...

That is, apply strbuf to tr, which is a Cygwin program.  You could even apply it to cat.

Alternatively, if the xgraph of which you speak is this:

https://sourceforge.net/projects/nsnam/files/xgraph/xgraph-12.1/

you might be able to re-build it under Cygwin, though doing so sometimes requires
some adjustments to a program or its build process (though a number of programs
build out-of-the-box pretty well).  Clearly this is hardr than trying the suggestion
above :-) ...

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

  reply	other threads:[~2018-08-18 14:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1925552125.164706.1534595788839.ref@mail.yahoo.com>
2018-08-18 15:23 ` Donald Krieger via cygwin
2018-08-18 15:27   ` Eliot Moss
2018-08-18 17:01     ` Donald Krieger via cygwin
2018-08-18 20:17       ` Eliot Moss [this message]
2018-08-18 22:31         ` Marco Atzeri
2018-08-19  0:47         ` Eliot Moss
     [not found] <1573638389.438706.1534689231242.ref@mail.yahoo.com>
2018-08-19 17:22 ` Donald Krieger via cygwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0ffc88a-a763-1e34-73cf-6d7592f9ba40@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).