@@ -143,7 +143,7 @@ def _run_command(command):
143
143
working_directory = get_safe_working_dir ()
144
144
145
145
kwargs = {
146
- "stderr" : subprocess .STDOUT ,
146
+ "stderr" : subprocess .PIPE ,
147
147
"cwd" : working_directory ,
148
148
"universal_newlines" : True ,
149
149
"env" : dict (os .environ , AZURE_CORE_NO_COLOR = "true" ),
@@ -154,14 +154,14 @@ def _run_command(command):
154
154
return subprocess .check_output (args , ** kwargs )
155
155
except subprocess .CalledProcessError as ex :
156
156
# non-zero return from shell
157
- if ex .returncode == 127 or ex .output .startswith ("'az' is not recognized" ):
157
+ if ex .returncode == 127 or ex .stderr .startswith ("'az' is not recognized" ):
158
158
raise CredentialUnavailableError (message = CLI_NOT_FOUND )
159
- if "az login" in ex .output or "az account set" in ex .output :
159
+ if "az login" in ex .stderr or "az account set" in ex .stderr :
160
160
raise CredentialUnavailableError (message = NOT_LOGGED_IN )
161
161
162
162
# return code is from the CLI -> propagate its output
163
- if ex .output :
164
- message = sanitize_output (ex .output )
163
+ if ex .stderr :
164
+ message = sanitize_output (ex .stderr )
165
165
else :
166
166
message = "Failed to invoke Azure CLI"
167
167
raise ClientAuthenticationError (message = message )
0 commit comments