From bd70123320f84bac803eed9ca1d54771b186df14 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Wed, 4 Jan 2017 23:58:41 -0600 Subject: [PATCH] Add hack to ensure a prompt function exists --- posh-git.psm1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/posh-git.psm1 b/posh-git.psm1 index bc310f9e9..b4120c73a 100644 --- a/posh-git.psm1 +++ b/posh-git.psm1 @@ -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(@'