Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Fixes issue when running cmdlet from PowerShell ISE
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinvanhunen committed Oct 12, 2020
1 parent 6e7fca0 commit 1adf0eb
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Commands/Base/InitializePowerShellAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,14 @@ protected override void ProcessRecord()
var waitTime = 60;
Host.UI.Write(ConsoleColor.Yellow, Host.UI.RawUI.BackgroundColor, $"Waiting {waitTime} seconds to start the consent flow in a browser window. This wait is required to make sure that Azure AD is able to initialize all required artifacts.");

Console.TreatControlCAsInput = true;

for (var i = 0; i < waitTime; i++)
{
Host.UI.Write(ConsoleColor.Yellow, Host.UI.RawUI.BackgroundColor, ".");
System.Threading.Thread.Sleep(1000);

// Check if CTRL+C has been pressed and if so, abort the wait
if (Host.UI.RawUI.KeyAvailable)
if (Stopping)
{
var key = Host.UI.RawUI.ReadKey(ReadKeyOptions.AllowCtrlC | ReadKeyOptions.NoEcho | ReadKeyOptions.IncludeKeyUp);
if ((key.ControlKeyState.HasFlag(ControlKeyStates.LeftCtrlPressed) || key.ControlKeyState.HasFlag(ControlKeyStates.RightCtrlPressed)) && key.VirtualKeyCode == 67)
{

break;
}
break;
}
}
Host.UI.WriteLine();
Expand Down

0 comments on commit 1adf0eb

Please sign in to comment.