tsl0922 / ttyd

Share your terminal over the web
https://tsl0922.github.io/ttyd
MIT License
8.06k stars 883 forks source link

Typing rendering issue with powershell command #562

Closed dmilov closed 3 years ago

dmilov commented 3 years ago

I'm running release 1.6.2. Running bash command has no issues. image

Running powershell command displays the previous characters on every new character typing. image

Is there a setting I can play with to make it work for PowerShell? I suppose is a latency issue somehow. I'm running ttyd in a container behind a proxy.

ravermeister commented 3 years ago

I think I've seen a Client option for Windows terminals, you could try if it helps to set it. See windowsMode

so minimal startup would be:
ttyd -t 'windowsMode=true' powershell.exe

dmilov commented 3 years ago

thanks for the suggestion, it doesn't work though. The weirdest thing is if I run bash command and then in the browser start PowerShell from bash it works fine. If I start powershell command with ttyd I reproduce it.

ravermeister commented 3 years ago

hmm so does this work? ttyd bash -c 'powershell'

dmilov commented 3 years ago

no, this doesn't work. Only if I run ttyd bash then in the browser I start powershell from bash, which doesn't solve my use-case because I want to start powershell with some parameters and have it in the browser.

I tested the gotty tool which is working fine in the same setup. It has other issues though. ttyd is the right tool for me but have to figure out how to make it work in this setup.

ravermeister commented 3 years ago

did you try to create a shell script with bash -c "/full/path/to/powershell args" and execute this script in ttyd?

dmilov commented 3 years ago

I did.

dmilov commented 3 years ago

I managed to reproduce the same building it from code into a docker container. Docker file is

FROM ubuntu:18.04
RUN apt-get update && apt-get install -y autoconf automake curl cmake git libtool make \
    && git clone --depth=1 https://github.com/tsl0922/ttyd.git /ttyd \
    && cd /ttyd && env BUILD_TARGET=x86_64 WITH_SSL=true ./scripts/cross-build.sh

FROM photon:3.0

RUN tdnf install powershell -y

COPY --from=0 /ttyd/build/ttyd /usr/bin/ttyd

ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini /sbin/tini
RUN chmod +x /sbin/tini

EXPOSE 8086
WORKDIR /root

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["ttyd", "-p", "8086", "pwsh"]

I run the container with

 docker run -p 8086:8086 ttyd

and test on the same machine.

If I replace 'pwsh' with 'bash' in the Dockerfile it works.

dmilov commented 3 years ago

When base OS is Ubuntu there is no issue. This is some corner case. If somebody can give some suggestion what could be the reason.

dmilov commented 3 years ago

-T linux option solves the problem. Thanks to @dcasota