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) {
532
532
}
533
533
534
534
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 ));
535
537
536
538
String workingDirectory = getSafeWorkingDirectory ();
537
539
if (workingDirectory != null ) {
@@ -621,6 +623,8 @@ AccessToken getTokenFromAzureDeveloperCLIAuthentication(StringBuilder azdCommand
621
623
}
622
624
623
625
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 ));
624
628
625
629
String workingDirectory = getSafeWorkingDirectory ();
626
630
if (workingDirectory != null ) {
Original file line number Diff line number Diff line change 11
11
import com .azure .identity .BrowserCustomizationOptions ;
12
12
import com .azure .identity .implementation .IdentityClientOptions ;
13
13
14
+ import java .io .File ;
14
15
import java .util .Arrays ;
15
16
import java .util .Collections ;
16
17
import java .util .List ;
@@ -22,6 +23,8 @@ public final class IdentityUtil {
22
23
public static final String ALL_TENANTS = "*" ;
23
24
public static final String DEFAULT_TENANT = "organizations" ;
24
25
26
+ public static final File NULL_FILE =
27
+ new File ((System .getProperty ("os.name" ).startsWith ("Windows" ) ? "NUL" : "/dev/null" ));
25
28
26
29
private IdentityUtil () { }
27
30
/**
You can’t perform that action at this time.
0 commit comments