From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126208 invoked by alias); 18 Aug 2018 14:28:59 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 126197 invoked by uid 89); 18 Aug 2018 14:28:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2365 X-HELO: mailsrv.cs.umass.edu Received: from mailsrv.cs.umass.edu (HELO mailsrv.cs.umass.edu) (128.119.240.136) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 Aug 2018 14:28:57 +0000 Received: from [192.168.0.30] (cpe-108-183-164-222.maine.res.rr.com [108.183.164.222]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id 45CEB401D9B6; Sat, 18 Aug 2018 10:28:54 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: stdbuf does not work To: cygwin@cygwin.com References: <1925552125.164706.1534595788839.ref@mail.yahoo.com> <1925552125.164706.1534595788839@mail.yahoo.com> <625442829.188518.1534601860831@mail.yahoo.com> From: Eliot Moss Message-ID: Date: Sat, 18 Aug 2018 20:17:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <625442829.188518.1534601860831@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00251.txt.bz2 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 :  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