|
28 | 28 | def call_tool_with_command(command: str, bin_path: Path) -> bool: |
29 | 29 | """Call an executable with a specific command.""" |
30 | 30 | if PLATFORM == "win32": |
31 | | - command = re.sub(r"^adb", re.escape(str(bin_path.joinpath(Path("adb.exe")))), command) |
32 | | - command = re.sub(r"^fastboot", re.escape(str(bin_path.joinpath(Path("fastboot.exe")))), command) |
33 | | - command = re.sub(r"^heimdall", re.escape(str(bin_path.joinpath(Path("heimdall.exe")))), command) |
| 31 | + command = re.sub(r"^adb", re.escape(str(bin_path.joinpath(Path("adb")))) + ".exe", command) |
| 32 | + command = re.sub(r"^fastboot", re.escape(str(bin_path.joinpath(Path("fastboot.exe")))) + ".exe", command) |
| 33 | + command = re.sub(r"^heimdall", re.escape(str(bin_path.joinpath(Path("heimdall.exe")))) + ".exe", command) |
34 | 34 | else: |
35 | 35 | command = re.sub(r"^adb", re.escape(str(bin_path.joinpath(Path("adb")))), command) |
36 | 36 | command = re.sub(r"^fastboot", re.escape(str(bin_path.joinpath(Path("fastboot")))), command) |
@@ -73,11 +73,13 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]: |
73 | 73 | "findstr", |
74 | 74 | "ro.product.device", |
75 | 75 | ], |
76 | | - stderr=STDOUT, |
| 76 | + stderr=STDOUT, shell=True, |
77 | 77 | ).decode() |
78 | 78 | else: |
79 | 79 | raise Exception(f"Unknown platform {platform}.") |
80 | | - return output.split("[")[-1].strip()[:-1].strip() |
| 80 | + device_code = output.split("[")[-1].strip()[:-1].strip() |
| 81 | + logger.info(device_code) |
| 82 | + return device_code |
81 | 83 | except CalledProcessError: |
82 | 84 | logger.info(f"Did not detect a device.") |
83 | 85 | return None |
0 commit comments