Skip to content

Any prompt for input on Linux times out. #1936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jclay opened this issue Apr 30, 2019 · 4 comments
Closed

Any prompt for input on Linux times out. #1936

jclay opened this issue Apr 30, 2019 · 4 comments
Labels

Comments

@jclay
Copy link

jclay commented Apr 30, 2019

System Details

System Details Output
### VSCode version: 1.33.1 51b0b28134d51361cf996d2f0a1c698247aeabd8 x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Linux 4.18.16-300.fc29.x86_64 #1 SMP Sat Oct 20 23:24:08 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

When running commands on Linux which are prefixed with sudo, the Powershell Integrated Console will timeout the prompt before there is chance to enter characters.

Expected Behaviour

The prompt should wait (indefinitely?) for the user to enter characters. This works as expected in any other terminal (even if I create an VSCode terminal which starts bash, then enter pwsh).

Actual Behaviour

As you can see below (the same happens for any command prefixed with sudo). If i don't type any characters, this times out in just over a second.

(base) PS> Measure-Command {read -s pass }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 1
Milliseconds      : 28
Ticks             : 10286362
TotalDays         : 1.19055115740741E-05
TotalHours        : 0.000285732277777778
TotalMinutes      : 0.0171439366666667
TotalSeconds      : 1.0286362
TotalMilliseconds : 1028.6362

How to Resolve

I was able to diagnose this myself in the end, but wanted to make a note for anyone else who may experience this.

I share my settings.json between Windows and Linux, and I had the following setting turned on to use PSReadline (for Windows):

    "powershell.developer.featureFlags": [
        "PSReadLine"
    ],

Disabling this setting and reloading seems to completely resolve the issue.

@jclay
Copy link
Author

jclay commented Apr 30, 2019

Since it looks like PSReadLine is enabled by default now, I suppose it's unlikely anyone would end up in this situation, unless they have an older settings file they end up moving to a Linux machine.

It could still be nice to protect against this if anyone does end up in this scenario. It had been frustrating me for quite some time before I got around to diagnosing.

Looks like it could be fixed by filtering the featureFlags out based on the OS here:

const featureFlags =
this.sessionSettings.developer.featureFlags !== undefined
? this.sessionSettings.developer.featureFlags.map((f) => `'${f}'`).join(", ")
: "";

@rjmholt
Copy link
Contributor

rjmholt commented Apr 30, 2019

Hi @jclay, thanks for opening an issue.

This is a known issue that we've been working toward fixing. I thought there would be an existing issue, but can't find one.

The problem occurs because PSReadLine must cancel the prompt in order to process messages from the extension. On Windows there is a solution to this problem, but on *nix the API does not exist. Essentially it's a difficult issue with no easy fix.

We chose to allow the usage of PSReadLine in *nix, but not have it turned on by default, as opposed to on Windows where PSReadLine is turned on by default. This is so it's still possible to opt-in to PSReadLine, but must be explicitly configured.

As I say, we're working toward a solution.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Jul 3, 2019

This is fixed if you use the preview version of PowerShell 7!

@TylerLeonhardt
Copy link
Member

We will be waiting to release the "preview" extension as "stable" until after 7 GA so I'm going to close this as there's no work on the extension side needed. The recommendation is to use PowerShell 7. 6.2 will be EOL 6 months after 7's release anyway.

For 6.2, we fallback to the legacy readline so at least the experience in the extension isn't broken, just not as nice as PowerShell 7's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants