Open randy3k opened 6 years ago
This looks like a bug. Thanks for reporting! I can't reproduce on my Linux system, but will try later again on OS X.
I can reproduce the same bug on Terminal.app and my another mac. I just notice that it does not happen every time I run python test.py
. The prompt is shown occasionally and it isn't shown some other times.
It may be related to this
root@1d92bea7b3b7:/# stty size
0 0
root@1d92bea7b3b7:/# reset -w
root@1d92bea7b3b7:/# stty size
24 80
Before reset, the stty size was not determined correctly. Also, the prompt in the above example would appear if I resize the terminal window.
I found a hacky solution from stackoverflow
docker exec -it python bash -c "stty cols $COLUMNS rows $LINES && bash"
Should this be documented as a bash oddity? Looks like it to me ...
I think prompt toolkit should nevertheless be able to handle the case of tty not getting the terminal size correctly.
I was trying to run my application on a python docker container but the prompt is not shown. Here is a simple way to reproduce it.
then in the container, install prompt_toolkit
a simple script
test.py
run the script and enter "foo"
Note that the prompt was not shown in above. Interestingly, it works again if I reset the terminal
BTW, I am using macOS iTerm if it matters.