Skip to content

Commit 41e4c7e

Browse files
committed
Fix Tests
1 parent 4beead1 commit 41e4c7e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,15 @@ protected void SaveDataCollectionProfile()
227227

228228
protected bool CheckIfInteractive()
229229
{
230+
if (this.Host == null || this.Host.UI == null || this.Host.UI.RawUI == null)
231+
{
232+
return false;
233+
}
234+
230235
bool interactive = true;
231236
try
232237
{
233-
var test = this.Host.UI.RawUI.CursorSize;
238+
var test = this.Host.UI.RawUI.KeyAvailable;
234239
}
235240
catch (HostException ex)
236241
{
@@ -298,9 +303,9 @@ protected void PromptForDataCollectionProfileIfNotExists()
298303
/// </summary>
299304
protected override void BeginProcessing()
300305
{
306+
InitializeProfile();
301307
PromptForDataCollectionProfileIfNotExists();
302308

303-
InitializeProfile();
304309
if (string.IsNullOrEmpty(ParameterSetName))
305310
{
306311
WriteDebugWithTimestamp(string.Format(Resources.BeginProcessingWithoutParameterSetLog, this.GetType().Name));

0 commit comments

Comments
 (0)