PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

PowerShell v6.0.0-alpha.14 is crashing in Container interactive terminals

Open brycem opened this issue 9 years ago • 4 comments

step1: docker build https://raw.githubusercontent.com/PowerShell/PowerShell/master/docker/release/nanoserver/Dockerfile -t alpha.14

step2: docker run -it --rm alpha.14 "c:\Program Files\PowerShell\Core\powershell.exe"

step3: type something...

result:

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>dir
 Volume in drive C has no label.
 Volume Serial Number is 8AE0-9651

 Directory of C:\

01/12/2017  10:35 PM             3,557 Dockerfile.log
11/20/2016  03:32 AM             1,894 License.txt
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\>"c:\Program Files\PowerShell\Core\powershell.exe"
PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\>
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
ir
ir : The term 'ir' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1
+ ir
+ ~~
    + CategoryInfo          : ObjectNotFound: (ir:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\>

notes this wasn't happening in Alpha.12... Seems to happen independent of the TTY terminal used (I tied minty.exe, vscode.exe, cmd.exe, and desktop powershell.exe on Win10 client)

In a newer version of the dockerfile I'm working on, this same build shows it working in in non-interactive mode. Also repros in windowsservercore

brycem avatar Jan 13 '17 06:01 brycem

Same happens with Alpha.15, I just appended an ENTRYPOINT instruction at the end of this Dockerfile and built it.

diff --git a/docker/release/windowsservercore/Dockerfile b/docker/release/windowsservercore/Dockerfile
index b31d36b..1d0b4ce 100644
--- a/docker/release/windowsservercore/Dockerfile
+++ b/docker/release/windowsservercore/Dockerfile
@@ -4,8 +4,8 @@ MAINTAINER [email protected]
 LABEL Readme.md="https://github.com/PowerShell/PowerShell/blob/master/docker/README.md"
 LABEL Description="This Dockerfile will install the latest release of PS."
 
-ARG POWERSHELL_MSI=https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.14/PowerShell_6.0.0.14-alpha.14-win10-x64.msi
-ARG POWERSHELL_SHA256=503F3AD52223699765895D3E9615FBD7988194693BCB725BE90C9EF0CD594447
+ARG POWERSHELL_MSI=https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.15/PowerShell_6.0.0-alpha.15-win10-win2k16-x64.msi
+ARG POWERSHELL_SHA256=CC52D21F3287E412B9C3B73C98BB5B06F8056D49D63201072216DF92B7F2E59B
 
 # Setup PowerShell - Log-to > C:\Docker.log
 SHELL ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "-command"]
@@ -46,3 +46,5 @@ RUN Start-Transcript -path C:\Dockerfile.log -append -IncludeInvocationHeader ;
 
 # Persist %PSCORE% ENV variable for user convenience
 ENV PSCORE='"C:\Program Files\PowerShell\Core\PowerShell.exe"'
+
+ENTRYPOINT ["C:\\Program Files\\PowerShell\\Core\\PowerShell.exe"]
$ docker build -t powershell .
$ docker run -it powershell
PowerShell 
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\> 

Then I tried to paste some text into the interactive terminal and the following error happens.

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 1 Keys:
 0

Exception:
System.ComponentModel.Win32Exception: Incorrect function
-----------------------------------------------------------------------
PSVersionTable

I only can press return to get a new prompt, but typing any other character the error also occurs.

PowerShell 
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\> 
PS C:\> 
PS C:\> 
PS C:\> 
PS C:\> 
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 5 Keys:
 Enter
 Enter
 Enter
 Enter
 d

Exception:
System.ComponentModel.Win32Exception: Incorrect function
-----------------------------------------------------------------------

StefanScherer avatar Feb 08 '17 06:02 StefanScherer

The same happens with alpha.18 using a container base image from microsoft/powershell.

alexandair avatar Apr 14 '17 00:04 alexandair

This should be fixed https://github.com/PowerShell/PowerShell/pull/3815

SteveL-MSFT avatar Jul 19 '17 15:07 SteveL-MSFT

Closing - the font related code is gone from this repo.

lzybkr avatar Nov 03 '17 05:11 lzybkr