Guard prompt function

Fixes #485.
This commit is contained in:
Andrew Schwartzmeyer
2016-02-05 11:51:17 -08:00
parent 39183cb4c3
commit 89ad38beae
+10 -1
View File
@@ -500,7 +500,16 @@ OPTIONS
// the user calling "exit".
while (!this.ShouldExit && this.myHost.Runspace != null)
{
string prompt = Prompt(this.myHost.Runspace);
// If the prompt function failed for any reason, use a sane default
string prompt;
try
{
prompt = Prompt(this.myHost.Runspace);
}
catch
{
prompt = "PS> ";
}
this.myHost.UI.Write(ConsoleColor.White, ConsoleColor.Black, prompt);
string cmd = consoleReadLine.Read(this.myHost.Runspace);