Skip to content
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

Prompt not appearing. Cmder/ConEmu, Windows 11 arm64 on M1 MacBook Pro under UTM. #940

Open
stevehjohn opened this issue Jan 28, 2023 · 7 comments

Comments

@stevehjohn
Copy link

System Details

  • posh-git version/path: latest as of 28/01/2023.
  • PowerShell version: 5.1.25276.1000
  • Git version: latest as of 28/01/2023.
  • Operating system name and version: Windows 11 arm64 on M1 MacBook under UTM.

Issue Description

Hi,

The posh-git prompt is not appearing even though the module is imported as verified by manually calling $GitPromptScriptBlock.Invoke().

image

I've used posh-git many times and still am on 2 other machines... something is just not working in this case.

As with the other machines, the terminal is cmder. I cannot figure out what is causing this.

Sorry to add to your issues.

Steve.

@dahlbyk
Copy link
Owner

dahlbyk commented Jan 30, 2023

Interesting. Is something else in your $PROFILE providing a custom prompt? posh-git won't override if prompt has changed from the default:

posh-git/src/posh-git.psm1

Lines 140 to 144 in 4b746d6

# If there is no prompt function or the prompt function is the default, replace the current prompt function definition
if ($ForcePoshGitPrompt -or !$currentPromptDef -or ($currentPromptDef -eq $defaultPromptDef)) {
# Set the posh-git prompt as the default prompt
Set-Item Function:\prompt -Value $GitPromptScriptBlock
}

Does Get-Item Function:\prompt | Select -Exp Definition match the posh-git prompt that starts here?

$GitPromptScriptBlock = {
$origDollarQuestion = $global:?
$origLastExitCode = $global:LASTEXITCODE

@stevehjohn
Copy link
Author

stevehjohn commented Jan 30, 2023

My $PROFILE file is empty.

Get-Item Function:\prompt | Select -Exp Definition

Returns the following...

      $realLASTEXITCODE = $LASTEXITCODE
      $host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
      PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
      CmderPrompt
      PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
      $global:LASTEXITCODE = $realLASTEXITCODE
      return " "

This is identical to what it returns on another machine where the prompt works.

Thanks,

Steve.

@dahlbyk
Copy link
Owner

dahlbyk commented Feb 1, 2023

If $PROFILE is empty, is posh-git loading from one of the other profile locations?

  • $PROFILE.AllUsersAllHosts
  • $PROFILE.AllUsersCurrentHost
  • $PROFILE.CurrentUserAllHosts
  • $PROFILE.CurrentUserCurrentHost

@stevehjohn
Copy link
Author

Hi,

Sorry, but they are all empty. Here is the script Cmder runs on startup if it helps...

https://gist.github.com/stevehjohn/a3d59cd0393f976b3e5c89c1a2f67777

Thanks,

Steve.

@dahlbyk
Copy link
Owner

dahlbyk commented Feb 1, 2023

And this same Cmder script has the expected behavior on other systems? I would expect this to be a problem everywhere: https://gist.github.com/stevehjohn/a3d59cd0393f976b3e5c89c1a2f67777#file-profile-ps1-L178-L182. Importing posh-git after a custom prompt exists will skip overwriting it. You can override that on import, or just import posh-git first. The Cmder script has a similar check to avoid overwriting a custom prompt.

Do you have a user_profile.ps1 or config\profile.d\*.ps1 on any of these systems?

@stevehjohn
Copy link
Author

Hey,

Yep all appears to be the same. I really don't know why one works and the other doesn't.

I don't want to waste too much of your time. I'll keep chipping away at it and see if I can get it working.

Feel free to close this issue, or leave it open if you'd like me to update with a solution if/when I find one.

Thanks,

Steve.

@dahlbyk
Copy link
Owner

dahlbyk commented Feb 2, 2023

You might try asking the Cmder folks? I know they've put effort into making it Just Work, so they may have ideas. Sorry!

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