From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100938 invoked by alias); 5 Dec 2018 17:42:37 -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 100821 invoked by uid 89); 5 Dec 2018 17:42:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=query X-HELO: mail-it1-f177.google.com Received: from mail-it1-f177.google.com (HELO mail-it1-f177.google.com) (209.85.166.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Dec 2018 17:42:35 +0000 Received: by mail-it1-f177.google.com with SMTP id b5so21520125iti.2 for ; Wed, 05 Dec 2018 09:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=FEsEgQCeRuCCZ+l7au1OkEubnvcX9b2Zm/0jwE8SiWI=; b=MDju7SCzqcwXjiplvuPLKm0oa7/ZR6jeVpPxFfmjqVLFw+HQrrzsk55thb4mdkxOAb KnAinwIyRV5RSWpwwsXwhFt0Gw3mN0IUkttL5v1ASUBKL/+wQEZb8Olo/tFHt4LopiFu 86d6MuZZt9qDnxLRompe0hEdq6aRn4Pp1xaXBdFl65rCd85lHy4vxGInLL20FI/rYSKu IdSM599Jup3wkhBMg7fJq1F1GhnTkRby5ZjGrST9i+dXOIjccEClmMXhY04cGxX4HU+A A/sKIjqFtD7h2O5RwWAcCl7H7MHVkiAjeBZ7ltIpHhNL7shvWHunT7kfJMREURJbyJwQ U17g== Return-Path: Received: from [192.168.0.5] (d47-69-109-131.nap.wideopenwest.com. [69.47.131.109]) by smtp.gmail.com with ESMTPSA id o16sm7129296ito.19.2018.12.05.09.42.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 09:42:32 -0800 (PST) Subject: Re: Redirecting stderr to stdout through pipe doesn't work the way it does in Linux To: cygwin@cygwin.com References: <6cc83f4b-b0b1-d5c9-8d59-94c51382e4e3@gmail.com> From: cyg Simple Message-ID: <37f0fb9b-5d70-ea1f-b1fc-1cd3f3ad0fa7@gmail.com> Date: Wed, 05 Dec 2018 17:42:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00052.txt.bz2 On 12/5/2018 10:11 AM, David Karr wrote: > 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? Your query got me interested in looking and I believe that winpty needs to be at the front of all the commands so that it can communicate with mintty properly. To overcome the need to remember you could add an alias to execute the command; `alias FOO="winpty FOO"'. -- cyg Simple -- 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