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

Commit 1adf0eb

Browse files
committed
Fixes issue when running cmdlet from PowerShell ISE
1 parent 6e7fca0 commit 1adf0eb

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Commands/Base/InitializePowerShellAuthentication.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,14 @@ protected override void ProcessRecord()
252252
var waitTime = 60;
253253
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.");
254254

255-
Console.TreatControlCAsInput = true;
256-
257255
for (var i = 0; i < waitTime; i++)
258256
{
259257
Host.UI.Write(ConsoleColor.Yellow, Host.UI.RawUI.BackgroundColor, ".");
260258
System.Threading.Thread.Sleep(1000);
261259

262-
// Check if CTRL+C has been pressed and if so, abort the wait
263-
if (Host.UI.RawUI.KeyAvailable)
260+
if (Stopping)
264261
{
265-
var key = Host.UI.RawUI.ReadKey(ReadKeyOptions.AllowCtrlC | ReadKeyOptions.NoEcho | ReadKeyOptions.IncludeKeyUp);
266-
if ((key.ControlKeyState.HasFlag(ControlKeyStates.LeftCtrlPressed) || key.ControlKeyState.HasFlag(ControlKeyStates.RightCtrlPressed)) && key.VirtualKeyCode == 67)
267-
{
268-
269-
break;
270-
}
262+
break;
271263
}
272264
}
273265
Host.UI.WriteLine();

0 commit comments

Comments
 (0)