Jaykul / PowerLine

A more PowerShell prompt
MIT License
567 stars 31 forks source link

Errors while using with PowerShell Core on Mac #18

Closed genebean closed 3 years ago

genebean commented 7 years ago

Ran into the problems below while trying this out on my Mac with the latest version of PowerShell:

PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

cdLoading personal and system profiles took 827ms.

PS /Users/gene.liverman> $PSVersionTable.PSVersion

Major Minor Patch Label
----- ----- ----- -----
    6     0     0 beta

PS /Users/gene.liverman> Install-Module PowerLine -Scope CurrentUser

Untrusted repository 
You are installing the modules from an untrusted repository. If you trust this repository,
change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you
sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

PS /Users/gene.liverman> Get-Module -ListAvailable PowerLine

    Directory: /Users/gene.liverman/.local/share/powershell/Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.3.1      PowerLine                           {Set-PowerLinePrompt, Add-PowerLineBlock, New-TextFactory, Get-Elapsed...}

PS /Users/gene.liverman> using module PowerLine
Exception calling "EnableVirtualTerminalProcessing" with "0" argument(s): "The type initializer for 'PoshCode.Pansies.Console.WindowsHelper' threw an exception."
    + CategoryInfo          : InvalidOperation: (/Users/gene.liv.../PowerLine.psd1:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TypeInitializationException,Microsoft.PowerShell.Commands.ImportModuleCommand

PS /Users/gene.liverman> $PowerLinePrompt = @(
>>         @{ bg = "Cyan";     fg = "White"; text = { $MyInvocation.HistoryId } }
>>         @{ bg = "DarkBlue"; fg = "White"; text = { $pwd } }
>>     )

PS /Users/gene.liverman> Set-PowerLinePrompt -PowerLineFont 
The property 'UseAnsiEscapes' cannot be found on this object. Verify that the property exists and can be set.
At /Users/gene.liverman/.local/share/powershell/Modules/PowerLine/2.3.1/PowerLine.psm1:420 char:5
+     $global:PowerLinePrompt.UseAnsiEscapes = $UseAnsiEscapes
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'RestoreVirtualTerminal' cannot be found on this object. Verify that the property exists and can be set.
At /Users/gene.liverman/.local/share/powershell/Modules/PowerLine/2.3.1/PowerLine.psm1:421 char:5
+     $global:PowerLinePrompt.RestoreVirtualTerminal = $RestoreVirtualT ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

PS>
TylerLeonhardt commented 6 years ago

Run into this too on macOS :(

Jaykul commented 5 years ago

This is a bug in PANSIES, obviously (not in PowerLine), but I'll leave this open to make sure I don't forget to deal with it. PANSIES is supposed to be cross-platform.

I think you just need to use an older version of PANSIES -- the pre-releases are kind-of Windows only (and I'm OK with that).

ExE-Boss commented 5 years ago

There is also #52, which is caused by https://github.com/PowerShell/PowerShell/issues/10092.

Jaykul commented 5 years ago

And apparently #44

Jaykul commented 3 years ago

I believe all of these are fixed now.

Since this is all very old, I'm going to assume people are as bad as I am about noticing notifications from github, and I'm going to close it without confirming with all of the reporters. If there are more cross-platform bugs, let's open new issues ;-)