docker run --rm -it microsoft/windowsservercore powershell
Copy 12345678901234567890123456789012345678901234567890hello
Paste that into the powershell window
Expected: entire string to be pasted
Actual: 'hello' is cut off
Removing PSReadline and paste works as expected
Is there any progress on this topic? I tried latest PowerShell alpha to validate, but ran into #492
I have seen that PowerShell 6 beta is out. Is there any update for this?
Current Docker image microsoft/windowsservercore:10.0.14393.1198
still has this problem.
This makes the powershell on windowsservercore
pretty unusable!
Please fix, this is really annoying
Agreed that this is annoying. We're hoping to improve the console API compatibility in windowsservercore
in the next Windows release, which I suspect will resolve this and several other issues. Currently I don't have any plans to debug this with the current set of images, unfortunately.
@daghb If you really need this feature now you can do this with a workaround commented in https://github.com/moby/moby/issues/29646#issuecomment-300483809
docker build -t pastable/windowsservercore https://raw.githubusercontent.com/StefanScherer/dockerfiles-windows/master/powershell-50-characters/Dockerfile
docker run -it pastable/windowsservercore powershell
As this is likely a containers issue - there is nothing I can do in PSReadLine, so I'm closing this issue. If it turns out that's incorrect - @jstarks will let me know and we'll reopen this issue.
I just tried the PowerShell 6 RC image on a Windows Server 2016, version 1709 with
docker run -it microsoft/powershell:6.0.0-rc-nanoserver-1709
and - oh my dear - even here I can reproduce the 50 char paste problem, both from a Mac Docker client as well as directly from the Windows Server machine:
Now we have the situation that it does not work for both windowsservercore and nanoserver.
So how can we proceed to get this fixed?
As you can see this is really annoying trying out some PowerShell commands in an isolated environment.
I also can reproduce the same problem in Windows Server Insider 17035 build.
Using the PowerShell 6.0.0-rc without the PSReadLine module works fine in Insider nanoserver 17035 container. OK, no colors, but pasting a 877 char long command just works fine. So I cannot imagine that this is a problem inside Windows and we have to wait for RS3. :-)
I can reproduce this problem without PSReadLine, I can even reproduce it in cmd. Paste the following:
echo 0
echo 12345678901234567890123456789012345678901234567890hello
echo 2
Note - 3 lines, not 1. The text hello
is not pasted on the second line, and the third line is never executed:
#1 PS> docker run --rm -it microsoft/windowsservercore cmd
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\>echo 0
0
C:\>echo 12345678901234567890123456789012345678901234
12345678901234567890123456789012345678901234
C:\>exit
It's possible people don't see this problem w/o PSReadLine because no single line is > 50 characters, but if there was, things probably won't work as expected.
OK, thanks @lzybkr I can repro this in my environment.
But I tried this just before (echo 3000 chars) and this works fine in cmd.
echo 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
So it's the kind how to read console input in PSReadLine that amplifies the effect. Agreed that something between docker CLI and the cmd in Container stops sending further if the process inside the container reads a little bit, then does something else (cmd executes the first echo) then wants to read more...
Interesting that pasting that command in a powershell does not stop at 50 chars but receives some more fragments. My repeatable results look like this:
PS C:\> echo 1
22 42
1
22
42
Removing PSReadLine from microsoft/nanoserver:6.0.0-rc-nanoserver-1709 makes this single line work for me as well in pwsh, but your three line example also stops in the second line. Really weird effect :-)
My theory - and actually how I came up with my example - is that if you are on cooked input mode, the paste works perfectly for everything up to the first newline. In cooked mode, it makes sense to not simulate keyboard input if possible - in other words, not generate an INPUT_RECORD
for each character.
After Enter (newline), conhost knows it is exiting cooked input mode, and must generate an INPUT_RECORD
for the remaining input in case some other console application wants to consume that input, which may be consumed via cooked input or raw input.
Normally I suggest using Ctrl+v to paste because it is faster and provides a more reliable experience, but with containers I think that's never an option - the host and container shouldn't be sharing clipboards.
At any rate, I think it's obvious there's nothing I can do to fix this in PSReadLine, but if someone finds a workaround, then that'd be great.
Still no fix for this? I did try this workaround here but that repo does not seem to exist anymore and the second command on it's own doesn't work.
https://github.com/PowerShell/PSReadLine/issues/460#issuecomment-341733715
Pretty sure it works in Windows 2019 or later
I'm also running into this... any progress?
@janheindejong - you haven't provided any details like which OS you're hitting the problem.
Based on https://github.com/microsoft/terminal/issues/38 it seems like this was fixed - though one comment says it reproduces in 1809.
Maybe @jstarks remembers which release has the fix.
I also have this problem. Windows 10 Pro 1909 with Powershell 7.0.0. Docker for Windows with Docker Engine v19.03.8 running Running Powershell 5.1.14393.1944.
Most helpful comment
This makes the powershell on
windowsservercore
pretty unusable!