Skip to content

Commit

Permalink
Add hack to ensure a prompt function exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Jan 5, 2017
1 parent f77a781 commit bd70123
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions posh-git.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ else {
$poshGitPromptScriptBlock = $null

$currentPromptDef = if ($funcInfo = Get-Command prompt -ErrorAction SilentlyContinue) { $funcInfo.Definition }

# HACK: If prompt is missing, create a global one we can overwrite with Set-Item
if (!$currentPromptDef) {
function global:prompt { ' ' }
}

if (!$currentPromptDef -or ($currentPromptDef -eq $defaultPromptDef)) {
# Have to use [scriptblock]::Create() to get debugger detection to work in PS v2
$poshGitPromptScriptBlock = [scriptblock]::Create(@'
Expand Down

0 comments on commit bd70123

Please sign in to comment.