Skip to content

pwsh as a dotnet global tool exhibits very unusual behavior with Ctrl-C #11314

@DHowett-MSFT

Description

@DHowett-MSFT

Steps to reproduce

Install powershell as a dotnet global tool. Run a long-running thing (like Start-Sleep), and then press Ctrl+C

Expected behavior

I am returned to a powershell prompt.

C:\Users\duhowett>.\.dotnet\tools\pwsh
PowerShell 6.2.3

(dhowett-dev2) ~ % start-sleep 10
^C
(dhowett-dev2) ~ % # i am returned to a powershell prompt

Actual behavior

The dotnet tool shim hosting powershell terminates and returns control to cmd, but powershell remains connected to the console and reads input simultaneously. PowerShell and CMD share the input buffer, and neither of them can agree on what goes into it.
If you manage to exit cmd, powershell re-asserts control.

The dir in the snippet below came from cmd

C:\Users\duhowett>.\.dotnet\tools\pwsh
PowerShell 6.2.3

(dhowett-dev2) ~ % start-sleep 10
^C
C:\Users\duhowett>
(dhowett-dev2) ~ % dir
 Volume in drive C is Cesium
 Volume Serial Number is E499-450A

 Directory of C:\Users\duhowett

image

The blue d came from powershell, and the ir came from cmd.

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions