Web lists-archives.com

Re: Any reason Cygwin might prevent kubectl exec from showing shell prompt?

On Tue, Jul 31, 2018 at 1:34 PM, David Karr <davidmichaelkarr@xxxxxxxxx>

> And I note that I tried running the same script from a Linux VM on my
> laptop, and it doesn't have this symptom, so it does seem to have something
> to do with Cygwin or Windows.
> On Tue, Jul 31, 2018 at 1:15 PM, David Karr <davidmichaelkarr@xxxxxxxxx>
> wrote:
>> On Tue, Jul 31, 2018 at 9:27 AM, Thomas Wolff <towo@xxxxxxxx> wrote:
>>> Am 31.07.2018 um 18:15 schrieb David Karr:
>>>> I really have no idea if this is a Cygwin problem, just trying to
>>>> eliminate variables.
>>>> I believe my Cygwin version is "2.9.0(0.318/5/3)" (from the uname
>>>> string).
>>>>  From a mintty window, I use a variation of "kubectl exec" in a script
>>>> to
>>>> run a shell in a container in a pod.  It appears to run, and I can run
>>>> processes from that shell in the container, but the curious thing is
>>>> that I
>>>> never get a shell prompt from the container.  I thought I had gotten
>>>> this
>>>> to work before, in the same k8s cluster, but I'm not certain.
>>> This may be an instance of the pty incompatibility issue of native
>>> Windows programs (which I assume kubectl to be).
>>> Try `winpty kubectl`, after installing winpty, that is.
>>> Maybe someone should put up a winpty cygwin package; maybe I should do
>>> it...
>> I hope this isn't it.  This is really the only issue I have with running
>> kubectl in Cygwin.  It takes and outputs text perfectly fine.  I use pipes
>> for input and output with no issues.  When I run kubectl with winpty, it
>> changes the text encoding in ways I don't understand yet.
Ok. It's a hack, but I guess it will work.  I execute kubectl with a shell
wrapper anyway, so now if "$1" == "exec", I prefix it with "winpty".  This
allows all the other operations to avoid that complexity, but still get a
shell prompt on exedc.

>>> The other curious thing I see is that if I execute "echo $PS1" in the
>>>> shell
>>>> in the container, it gives me a reasonable response ("\w \$"), but if I
>>>> instead do "env | grep PS1", it returns nothing.
>>> You may have set PS1 in your .profile (or .bashrc) but not exported it
>>> into the environment (export PS1).
>> I guess that makes sense. It appears to be irrelevant to my problem.

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