Powershell: non-Windows Enter-PSHostProcess destroys TTY for the rest of the life of the process

Created on 3 Sep 2020  路  3Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

Open 2 PowerShell windows of the same version

create a file foo.ps1 that looks like this:

"hello"
Start-Sleep -Seconds 20
"boo"

In PowerShell one

PS > $pid | scb

In PowerShell two

PS > Enter-PSHostProcess -Id <PASTE>

In PowerShell one

PS > tty

Expected behavior

PS > tty
/dev/ttys008

Actual behavior

PS > tty
not a tty

What's also really bad about this is that when you exit the remoting session and run tty again... the result is the same not a tty which mean we don't even put it back in a good state after the remote session.

We should figure out how to not get into this state in the first place...

Why is this bad

Any executable (like Vim, Sudo, etc) that needs a tty, will fail to run:

image

Environment data

Name                           Value
----                           -----
GitCommitId                    7.1.0-daily.20200430
PSVersion                      7.1.0-daily.20200430
WSManStackVersion              3.0
Platform                       Unix
SerializationVersion           1.1.0.1
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0鈥
OS                             Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64
PSRemotingProtocolVersion      2.3
PSEdition                      Core

Although this bug existed in 7.0...

Issue-Question WG-Remoting

Most helpful comment

i tried this on a windows system as well, and while it can't be tested with /bin/tty I can confirm that my console vi app has difficulty (the process doesn't start, but the prompt will return after ^C

All 3 comments

i tried this on a windows system as well, and while it can't be tested with /bin/tty I can confirm that my console vi app has difficulty (the process doesn't start, but the prompt will return after ^C

/cc @PaulHigin for information.

Tested with vim on Windows. While the process does start... it is not happy about something.

image

Was this page helpful?
0 / 5 - 0 ratings