Skip to content

“An empty pipe element is not allowed” When Using “Run Selected Text” #2199

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
DesertBear opened this issue Sep 21, 2019 · 1 comment
Labels
Resolution-Duplicate Will close automatically. Resolution-Fixed Will close automatically.

Comments

@DesertBear
Copy link

System Details

Windows 10 – 1903 (18362.356)
PS1 file – UTF-8, CRLF

System Details Output

### VSCode version: 1.38.0 3db7e09f3b61f915d03bbfa58e258d6eee843f35 x64

### VSCode extensions:       
[email protected]


### PSES version: 1.12.1.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.18362.145
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.145
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When selecting text in the editor and using [Terminal > Run Selected Text] to run that part of it in the integrated console, if there’s a pipe that pipes to the next line, then the integrated console displays an error message saying “An empty pipe element is not allowed.”

Example:

Get-AuthenticodeSignature -FilePath "$env:SystemRoot\explorer.exe" | 
Format-List

Error message:

An empty pipe element is not allowed.
At line:0 char:0

Screenshot:
Screenshot A

  • If it pipes to the same line—rather than the next line—it works OK
  • When using [Terminal > Run Active file] to run the whole PS1 file from disk it works OK
  • When using [Right-click in editor window > Run Selection] it works OK
  • When using keyboard shortcut [F8] it works OK
  • When copy and pasting from VS Code editor in to regular Windows PowerShell it works OK

Expected Behaviour

The command should run without an “An empty pipe element is not allowed” error.

Actual Behaviour

The integrated console displays an error message saying “An empty pipe element is not allowed.”

@ghost ghost added the Needs: Triage Maintainer attention needed! label Sep 21, 2019
@TylerLeonhardt
Copy link
Member

@DesertBear this is because the stable version of the PowerShell extension cannot handle multiline input on paste or [Terminal > Run Selected Text]. However, this does work in the preview extension because that has PSReadLine support (#1793).

I'm going to close this issue since the work is in preview but pay close attention to #1793 for when PSReadLine makes it into stable.

@TylerLeonhardt TylerLeonhardt added Resolution-Duplicate Will close automatically. Resolution-Fixed Will close automatically. and removed Needs: Triage Maintainer attention needed! labels Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate Will close automatically. Resolution-Fixed Will close automatically.
Projects
None yet
Development

No branches or pull requests

2 participants