File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -532,6 +532,8 @@ AccessToken getTokenFromAzureCLIAuthentication(StringBuilder azCommand) {
532532 }
533533
534534 ProcessBuilder builder = new ProcessBuilder (starter , switcher , azCommand .toString ());
535+ // Redirects stdin to dev null, helps to avoid messages sent in by the cmd process to upgrade etc.
536+ builder .redirectInput (ProcessBuilder .Redirect .from (IdentityUtil .NULL_FILE ));
535537
536538 String workingDirectory = getSafeWorkingDirectory ();
537539 if (workingDirectory != null ) {
@@ -621,6 +623,8 @@ AccessToken getTokenFromAzureDeveloperCLIAuthentication(StringBuilder azdCommand
621623 }
622624
623625 ProcessBuilder builder = new ProcessBuilder (starter , switcher , azdCommand .toString ());
626+ // Redirects stdin to dev null, helps to avoid messages sent in by the cmd process to upgrade etc.
627+ builder .redirectInput (ProcessBuilder .Redirect .from (IdentityUtil .NULL_FILE ));
624628
625629 String workingDirectory = getSafeWorkingDirectory ();
626630 if (workingDirectory != null ) {
Original file line number Diff line number Diff line change 1111import com .azure .identity .BrowserCustomizationOptions ;
1212import com .azure .identity .implementation .IdentityClientOptions ;
1313
14+ import java .io .File ;
1415import java .util .Arrays ;
1516import java .util .Collections ;
1617import java .util .List ;
@@ -22,6 +23,8 @@ public final class IdentityUtil {
2223 public static final String ALL_TENANTS = "*" ;
2324 public static final String DEFAULT_TENANT = "organizations" ;
2425
26+ public static final File NULL_FILE =
27+ new File ((System .getProperty ("os.name" ).startsWith ("Windows" ) ? "NUL" : "/dev/null" ));
2528
2629 private IdentityUtil () { }
2730 /**
You can’t perform that action at this time.
0 commit comments