Skip to content

Commit 731bd8d

Browse files
authored
{Misc} Fix UP022. Use capture_output for subprocess.run. (#30452)
1 parent 3ce5df2 commit 731bd8d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/azure-cli/azure/cli/command_modules/resource/_bicep.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ def _get_bicep_env_vars(custom_env=None):
339339
def _run_command(bicep_installation_path, args, custom_env=None):
340340
process = subprocess.run(
341341
[rf"{bicep_installation_path}"] + args,
342-
stdout=subprocess.PIPE,
343-
stderr=subprocess.PIPE,
342+
capture_output=True,
344343
env=_get_bicep_env_vars(custom_env))
345344

346345
try:

src/azure-cli/azure/cli/command_modules/security/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def run_cli_cmd(cmd, retry=0):
1616
import json
1717
import subprocess
1818

19-
output = subprocess.run(cmd, shell=True, check=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
19+
output = subprocess.run(cmd, shell=True, check=False, capture_output=True)
2020
if output.returncode != 0:
2121
if retry:
2222
run_cli_cmd(cmd, retry - 1)

0 commit comments

Comments
 (0)