-
Notifications
You must be signed in to change notification settings - Fork 298
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
Powershell Prompt Double Execution #468
Comments
From @lukemgriffith on August 18, 2016 23:11 I'm also seeing the same on MacOS 10.11.6
I see the verbose "Test" twice. |
From @Jaykul on August 18, 2016 23:38 Ditto for Ubuntu 16.04 I had to stop using Write-Host ... now using escape sequences for color ;-) |
From @whatevergeek on August 20, 2016 11:21 @myyc which details you need? i'm still in the process of getting the source built on my machine... will try to help also once i get the setup done :-) |
From @myyc on August 20, 2016 11:26 @whatevergeek details on how to use escape sequences instead of write-host ... |
From @theaquamarine on August 22, 2016 22:45 @myyc there's a bit of an example here dahlbyk/posh-git#282 (comment) |
From @Jaykul on August 23, 2016 0:5 Oh, I'm sorry, I didn't mean to leave you hanging. Here's what I have so far, it works on Windows 10 and Linux, even in VS Code ... but obviously not anywhere that ANSI escape sequences don't work (e.g. ISE): http://poshcode.org/6485 |
@lzybkr any ideas? function prompt {
|
Yeah, I see the same thing -- I originally reported that here PowerShell/PowerShell#2770 (comment) |
The double invocation shouldn't be there (I pointed out the problem before it got merged originally) - but it was put there to support making the prompt red on error. When that goes, we will need a new way to indicate errors. |
I wonder if you could change the color of the cursor to the error colors? |
Could we get an option to disable the error indicator until this issue is fixed? Or if this isn't an option you want long term, perhaps an env var we can use to "backdoor" disable it? Say |
Any idea when this will be fixed? The issue still persists in: PS> $IsOSX
True
PS> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.18
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1 |
Still in beta-1
|
A fix was made in the powershell repository to address this, though not fully. See PowerShell/PowerShell#3867 |
This branch has a fix (and supports escape sequences) but isn't quite ready - I think just one big thing left for Linux - custom key bindings. It's very usable on Windows right now. |
@lzybkr Great! Should this branch "just work" if we compile the module and make sure it will be loaded first in |
@drvink - Not quite. In Windows PowerShell, yes, but you probably don't care about Windows PowerShell. PowerShell Core lists PSReadline in it's trust platform assemblies, so you can't actually update it via the module path. There are 2 options:
I've done both, 1. on Windows and 2. on Linux. I've done minimal testing in PowerShell Core, definitely more on Windows, and I think it mostly works on Windows. On Linux you won't get custom key binding support yet. There is also one serious bug that crashes PowerShell (as in, it exits). I believe it's a .Net bug but haven't thoroughly investigated. The bug happens when you use Shift+arrows to select. It also depends on something else that I haven't tracked down, but if you repeatedly hit Shift+arrow, you might not hit it, but if you don't release the arrow key, you will probably hit it. |
@lzybkr I just dropped the updated module into my profile path: PS C:\Users\wojang> (Get-Module PSReadLine).ModuleBase
C:\Users\wojang\Documents\PowerShell\Modules\PSReadLine\2.0
PS C:\Users\wojang> Get-Module psreadline -ListAvailable
Directory: C:\Users\wojang\Documents\PowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.0 PSReadLine {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remov...
Directory: C:\program files\powershell\6.0.0-beta.7\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.2 PSReadLine {Get-PSReadlineKeyHandler, |
But did it load it? You can check with |
@lzybkr Well... Crap... No... I guess that explains some differences I've noticed in PSReadline handling between PowerShell 5.1 and PowerShell 6... < le sigh /> No I just have to find that list again... |
I haven't tried in WSL yet, but @SteveL-MSFT said it worked for him. Debugging would be great - the rendering code no longer uses Win32 console apis - it's pure .Net, so it should work anywhere. I have copied the sources into the PowerShell repo and built from there on Linux. It would also be nice to get the tests running on Linux. I'm avoiding the move to netstandard2.0 until the PowerShell team figures out how to deploy the type forwarding dlls because no module should be doing that. |
The PSReadLine assembly didn't have the resources defined in the right namespace. I added the I did manage to get the unit tests to compile but only about 5 out of 150 pass. The vast majority fail because of a null ref exception on rs.Open() in the
In fact,
Oh yeah, I had to comment out a fair bit of test code that was testing the clipboard. You can see the changes I've made so far in my repo - rkeithhill@e3beb6f BTW when I debug this from VSCode, I see a lot of DLLs loaded but I don't see SMA.dll. |
I believe this is fixed in #561. I'll publish a pre-release version to the PowerShell Gallery as soon as they support pre-releases. If you'd like to try a fix before that, you can build the lastest yourself from the master branch, or Note the version number is now 2.0, so be sure to copy the contents to \PSReadLine\2.0. |
With some small changes I was able to drop the PSReadLine master branch into the PowerShell git repo (using tag v6.0.0-beta.8) and build it on Linux. It's mostly working! Looks fine in a bare xterm, but try running powershell under |
The binary built from this repo works in PowerShell Core all platforms too. Artifacts in screen are new? I wonder if I'm using an escape sequence that isn't supported under screen. |
The junk I'm seeing is |
I can reproduce, and I'm |
Sorry, brainfart--you would want to
The last |
Thanks, that's super helpful. I had to set So the quick fix is to just remove where I do that, but I'm not sure that's the right fix. |
@drvink - I just pushed what should fix the |
@lzybkr Thanks! I don't have time to test it at the moment, but that sounds like the right fix to me as well. I'll try to comment when I get a chance to rebuild with the new changes, but if you aren't getting the incorrectly-emitted escape sequences when you |
I'll have an official prerelease build out next week if you want to verify this is fixed, otherwise you can grab a build out of appveyor here. |
|
@lzybkr Just wanted to report that things work fine under |
@pcgeek86 the backslashes is an issue with |
@SteveL-MSFT Cool, thank you for calling that out! |
From @whatevergeek on August 18, 2016 18:44
Version: powershell_6.0.0-alpha.9-1ubuntu1.14.04.1_amd64.deb
Platform: Ubuntu 14.04
Steps to reproduce
function prompt
{
Write-Host ("This>")
return " "
}
Expected behavior
It should only print "This>" once.
Actual behavior
It prints "This>" twice.
Environment data
Copied from original issue: PowerShell/PowerShell#1897
The text was updated successfully, but these errors were encountered: