Skip to content

Commit 5c74dc5

Browse files
author
Hovsep
committed
Merge pull request #1140 from hovsepm/dev
[#103424390] Disable prompts in non interactive mode
2 parents 8da5fe3 + 280ddf1 commit 5c74dc5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using System.IO;
2626
using System.Management.Automation.Host;
2727
using System.Text;
28+
using System.Linq;
2829
using System.Threading;
2930

3031
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
@@ -160,7 +161,10 @@ public static bool IsDataCollectionAllowed()
160161
protected bool CheckIfInteractive()
161162
{
162163
bool interactive = true;
163-
if (this.Host == null || this.Host.UI == null || this.Host.UI.RawUI == null)
164+
if (this.Host == null ||
165+
this.Host.UI == null ||
166+
this.Host.UI.RawUI == null ||
167+
Environment.GetCommandLineArgs().Any(s => s.Equals("-NonInteractive", StringComparison.OrdinalIgnoreCase)))
164168
{
165169
interactive = false;
166170
}

0 commit comments

Comments
 (0)