Redirecting stderr to stdout through pipe doesn't work the way it does in Linux

David Karr
Thu Dec 6 01:03:00 GMT 2018

On Wed, Dec 5, 2018 at 4:20 PM Andrey Repin <> wrote:

> Greetings, David Karr!
> > Sigh. What a mess. I can't get this to work.  It was easy enough when a
> > single script has to execute "kubectl", having "winpty" prefix that call,
> > but I'm trying to write a script that calls that other script, and even
> in
> > a pipeline.
> > If I have "winpty" prefix the call to the script that calls "kubectl", it
> > says:
> >     winpty: error: cannot start '...': Not found in PATH
> Either
> kubectl(){ .../winpty ...\\kubectl }; readonly -f kubectl
> > When I changed it so it references the absolute path, it then says "%1 is
> > not a valid Win32 application. (error 0xc1)".  So, this makes it clear
> that
> > winpty can only directly execute Windows applications, which makes sense.
> > So how can I call a Windows application from more than just the top-level
> > script?
> or write a Cygwin wrapper for kubectl and place it where it is usually
> located
> on *NIX system.
> Do NOT add kubectl or winpty to Cygwin $PATH, since both are not Cygwin
> apps
> and their presence only confuses you.
> Wrapper would probably be more universal.

I don't see how any of this can help.  It appears that I can only "winpty"
a process if it's "at most one level deep", if that makes any sense.  I
tried writing a "kubectl" script and putting it in my path before the
Windows kubectl, and having the script execute that, and prefix the call
with "winpty".  It doesn't work if the call to "kubectl" is "deeper" in the
script chain.

What's even worse is that I didn't need "winpty" for all of the kubectl
subcommands, only "exec".  By now adding "winpty" as a prefix for all
kubectl subcommands, it messes up the output of things that just emit text.
I now have " [0K" ending all my output lines.

> --
> With best regards,
> Andrey Repin
> Thursday, December 6, 2018 3:09:46
> Sorry for my terrible english...

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list