Powershell: Running PowerShell core in a Shell in a Box web application results in a broken UX

Created on 24 May 2017  路  12Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

I have configured a Shell in a Box web server such that the.ip.address/ps will invoke docker run -e TERM=xterm -it microsoft/powershell, and in the docker session I connect to in the browser where TERM is set to xterm, all commands I type appear at the top of the window instead of inline at the prompt. Also, it can be very difficult to enter commands after you have run some commands. Terminal emulation seems quite broken here.

Expected behavior

I should be able to enter commands at the prompt, and results should appear after those commands, with a new prompt ready for additional commands.

Actual behavior

Whenever I type in a command, it appears at the top of the window instead of at the prompt.

Environment data

@SteveL_MSFT has the repro for this issue.

image

Issue-Discussion WG-Interactive-Console

All 12 comments

Have you compared the behavior that you see vs the behavior of a local docker run -i with interactive PowerShell? I know that there are terminal emulation issues there that are unrelated to Shell in a Box.

docker run -it microsoft/powershell on the same system (Ubuntu 14.04) works just fine, without the terminal emulation issues that I get from running the same inside of Shell in a Box. Even if I explicitly set TERM=xterm as part of the docker run command I still get terminal emulation issues that make it pretty much unusable.

I tried this and there is a significant difference with ShellInABox, particularly compared to Bash

I don't think this issue is critical for the 6.0.0 release, so deferring it to 6.1.0 unless someone else wants to investigate. However, I did find a workaround. Use: powershell -file - so that input is read from STDIN and also rmo psreadline and you get a decent experience.

This issue matters to me and it is something I would really like to see resolved sooner rather than later, but I'm really not sure where to start looking to identify and fix this bug. If anyone has any pointers on where to dig in here, I'll be happy to dig in and see if I can get it resolved in the 6.0.0 timeframe.

@KirkMunro if you want to investigate this, I would suggest comparing the input loop when PowerShell is reading from stdin using -file - and when using the Console api's (look for ReadKey()). If we can make it through our existing 6.0.0-HighPriority backlog, I can take a deeper look into this.

We had Issue #546 for Console.CursorTop and the fix was in CoreFX.

Adding my vote - I was hoping to use ShellInABox to provide web access to PowerShell running in a docker instance and have hit the same issues.

At your request, tagging you @SteveL-MSFT to make this issue visible again.

There's problem a number of issues, but the first one is https://github.com/dotnet/corefx/issues/27990

Currently appears to be an issue with ShellInABox not returning the vt100 response to the console https://github.com/shellinabox/shellinabox/issues/428

Thanks for digging into this @SteveL-MSFT, I really appreciate it.

Was this page helpful?
0 / 5 - 0 ratings