Skip to content

Line continuation with line-initial | (pipe symbol) not recognized on Unix-like platforms. #1261

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
mklement0 opened this issue Dec 20, 2019 · 3 comments

Comments

@mklement0
Copy link

mklement0 commented Dec 20, 2019

PS Core now supports continuing a pipeline by placing the | at the start of the following line.

On Windows pasting such a pipeline works fine, but not on Unix-like platforms (macOS, Linux).

Environment data

PS version: 7.0.0-rc.1
PSReadline version: 2.0.0-rc1
os: Darwin MkiMac.home 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
PS file version: 7.0.0.0
HostName: ConsoleHost
BufferWidth: 180
BufferHeight: 60

Steps to reproduce or exception report

On macOS or Linux, paste the following in a PowerShell terminal:

Get-Date
  | % ToUniversalTime

This works fine on Windows, but on Unix-like platforms the 2nd line is unexpectedly treated as a new command, which predictably fails:

ParserError:
Line |
   1 |   | % ToUniversalTime
     |   ^ An empty pipe element is not allowed.
@mklement0 mklement0 changed the title Line continuation with line-initial Line continuation with line-initial | (pipe symbol) not recognized on Unix-like platforms. Dec 20, 2019
@mklement0
Copy link
Author

Sorry, @lzybkr, I accidentally submitted this without content first - the report is now complete.

@msftrncs
Copy link
Collaborator

This is, actually related to certain terminals, and so can be reproduced on Windows as well if not using ConsoleHost (VS Code's terminal is a prime suspect), and it has to do with whether the paste operation is performed by the terminal, or handled directly by PSReadLine.

I think @lzybkr or @daxian-dbw might be looking in to a solution, related to the speed at which input characters are arriving for processing, and using that as a signal that the terminal is 'pasting'.

This is then, effectively, a duplicate to #579. Pasting on 'nix is equivalent to right-click pasting on Windows.

@mklement0
Copy link
Author

Thanks, @msftrncs - I keep forgetting about #579; indeed sounds like I've created another duplicate, so I'm closing this.

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

No branches or pull requests

2 participants