Skip to content

Commit b0dfd45

Browse files
committed
Improve logging for the run_command function
1 parent 2496423 commit b0dfd45

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

openandroidinstaller/tooling.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def run_command(
4242
enable_logging: bool = True,
4343
) -> TerminalResponse:
4444
"""Run a command with a tool (adb, fastboot, heimdall)."""
45-
yield f"${full_command}"
4645
# split the command and extract the tool part
4746
tool, *command = shlex.split(full_command)
4847
if tool not in ["adb", "fastboot", "heimdall"]:
@@ -55,10 +54,11 @@ def run_command(
5554
else:
5655
command_list = [str(bin_path.joinpath(Path(f"{tool}")))] + command
5756
si = None
58-
if enable_logging:
59-
logger.info(f"Run command: {command_list}")
6057
if target:
6158
command_list.append(f"{target}")
59+
if enable_logging:
60+
logger.info(f"Run command: {command_list}")
61+
yield f"${full_command}"
6262
# run the command
6363
with subprocess.Popen(
6464
command_list,

0 commit comments

Comments
 (0)