Handle Ctrl-C while prompting

This commit is contained in:
Andrew Schwartzmeyer committed 2016-07-08 13:48:51 -07:00
1 parent 3572367c00
commit 68875f0942
1 file changed
+13
@@ -1720,11 +1720,17 @@ namespace Microsoft.PowerShell
// the empty string.
#if LINUX
bool treatControlCAsInput = Console.TreatControlCAsInput;
try
{
ConsoleKeyInfo keyInfo;
string s = "";
int index = 0;
int cursorLeft = Console.CursorLeft;
int cursorCurrent = cursorLeft;
Console.TreatControlCAsInput = true;
#else
rawui.ClearKeyCache();
uint keyState = 0;
@@ -1900,6 +1906,13 @@ namespace Microsoft.PowerShell
"s should only be null if input ended with a break");
return s;
#if LINUX
}
finally
{
Console.TreatControlCAsInput = treatControlCAsInput;
}
#endif
}
/// <summary>