Skip to content

Commit

Permalink
{Misc} Fix UP022. Use capture_output for subprocess.run. (Azure#30452)
Browse files Browse the repository at this point in the history
  • Loading branch information
atombrella authored Dec 4, 2024
1 parent 3ce5df2 commit 731bd8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/azure-cli/azure/cli/command_modules/resource/_bicep.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ def _get_bicep_env_vars(custom_env=None):
def _run_command(bicep_installation_path, args, custom_env=None):
process = subprocess.run(
[rf"{bicep_installation_path}"] + args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
env=_get_bicep_env_vars(custom_env))

try:
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/security/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def run_cli_cmd(cmd, retry=0):
import json
import subprocess

output = subprocess.run(cmd, shell=True, check=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
output = subprocess.run(cmd, shell=True, check=False, capture_output=True)
if output.returncode != 0:
if retry:
run_cli_cmd(cmd, retry - 1)
Expand Down

0 comments on commit 731bd8d

Please sign in to comment.