From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20446 invoked by alias); 5 Dec 2018 15:11:30 -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 20422 invoked by uid 89); 5 Dec 2018 15:11:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:alternative X-HELO: mail-ed1-f42.google.com Received: from mail-ed1-f42.google.com (HELO mail-ed1-f42.google.com) (209.85.208.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Dec 2018 15:11:28 +0000 Received: by mail-ed1-f42.google.com with SMTP id f9so10839826eds.10 for ; Wed, 05 Dec 2018 07:11:27 -0800 (PST) MIME-Version: 1.0 References: <6cc83f4b-b0b1-d5c9-8d59-94c51382e4e3@gmail.com> In-Reply-To: <6cc83f4b-b0b1-d5c9-8d59-94c51382e4e3@gmail.com> From: David Karr Date: Wed, 05 Dec 2018 15:11:00 -0000 Message-ID: Subject: Re: Redirecting stderr to stdout through pipe doesn't work the way it does in Linux To: The Cygwin Mailing List Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00050.txt.bz2 On Tue, Dec 4, 2018 at 12:52 PM Marco Atzeri wrote: > Am 04.12.2018 um 21:41 schrieb David Karr: > > "CYGWIN_NT-6.1 WACDTL03DK068X 2.9.0(0.318/5/3)" > > > > I installed a version of "kubectl" for windows, and I use it extensively > in > > Cygwin bash for scripting command-line automation. In general, this works > > perfectly fine. I even use the same scripting in a Linux VM. > > > > I'm seeing an issue with one script that works fine in the Linux VM, but > > not in Cygwin. > > > > The command line is approximately this: > > > > kubectl exec pod -c container -i -t -- grep "string" > stuff.properties > > 2>&1 | sed -e 's/^propname=//' > > > > In Linux, this works perfectly fine. In Cygwin, it says "stdout is not a > > tty". > > > > I haven't updated my local Cygwin installation for quite a while. I'd > > prefer not to, unless there is a strong chance this kind of thing would > be > > fixed. > > > > as kubectl is not a Cygwin program, it is not aware of cygwin pty. > You can try to use winpty to overcome the problem. > > https://github.com/rprichard/winpty > > > It turns out that not only had I already used winpty for similar functionality, it was actually in place in the pipeline when I tried to do this. When I turned on debugging output, it showed that kubectl was already being wrapped by winpty when it reported "stdout is not a tty". However, this was one shell script wrapper deeper than I usually call it. Does it matter whether winpty is called from the shell script I'm calling, or from the script being called by the script I'm calling? -- 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