X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=nzHNPpFdfqBj3kBu 5vc2NztmAE65cymDNJD4ZkRU14F4gf6Dpt4hNFJVqk9D0ULfulQ20rjvKlGX00GV uii20r+y7xFdKvIEmuaxYobjJJ7X3VoxaQ/M1jy2WqTk649X/uftS8cBTvP3H0VM lF7CpB7hJ0jIX75IW8451cG2z9s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=GCMAFY9k24JZ80iH/X+zdX iegTQ=; b=pGvDDoBcgikH1VFjjJQHon2gIpjtX/dbhDG1hqOzLGG+5omNw4QJiv /wjXRBQzWhSEU8aqhLqZow4fMH3h7LOIKKjdZra94WmsGgDHlS2nK7TTW2g144Il 7AHHFZfPNVIdLCsBy4xO9mWdM+wCDTVG5ZZ6CC+Z65af1CT1Wkdv0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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== Subject: Re: Redirecting stderr to stdout through pipe doesn't work the way it does in Linux To: cygwin AT cygwin DOT com References: <6cc83f4b-b0b1-d5c9-8d59-94c51382e4e3 AT gmail DOT com> From: cyg Simple Message-ID: <37f0fb9b-5d70-ea1f-b1fc-1cd3f3ad0fa7@gmail.com> Date: Wed, 5 Dec 2018 12:42:29 -0500 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 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