(cmd, not_read=False)
| 270 | return adb_device.shell(cmd, stream=stream) |
| 271 | |
| 272 | def run_su_command(cmd, not_read=False): |
| 273 | try: |
| 274 | if not_read: |
| 275 | _shell(f"{cmd} > /dev/null 2>&1 &") |
| 276 | time.sleep(1) |
| 277 | return |
| 278 | output = _shell(cmd).strip() |
| 279 | if output: |
| 280 | return output |
| 281 | except Exception: |
| 282 | pass |
| 283 | conn = _shell(["su", "-c", cmd], stream=True) |
| 284 | try: |
| 285 | if not_read: |
| 286 | time.sleep(1) |
| 287 | return |
| 288 | output = conn.read_until_close() |
| 289 | return output.strip() |
| 290 | finally: |
| 291 | try: |
| 292 | conn.close() |
| 293 | except Exception as e: |
| 294 | pass |
| 295 | |
| 296 | |
| 297 | def get_is_magisk_root() -> bool: |
no test coverage detected