From 0d262a27badfdb1a9c645fb3d32ea6e68b63eed2 Mon Sep 17 00:00:00 2001 From: Wenjun Zhou Date: Sat, 27 Jan 2024 16:08:19 +0800 Subject: [PATCH] cli_common: Fix `wait_return` availability on Windows --- pymobiledevice3/cli/cli_common.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pymobiledevice3/cli/cli_common.py b/pymobiledevice3/cli/cli_common.py index 6c488d988..104a1cca6 100644 --- a/pymobiledevice3/cli/cli_common.py +++ b/pymobiledevice3/cli/cli_common.py @@ -2,7 +2,6 @@ import json import logging import os -import signal import sys import uuid from typing import Callable, List, Mapping, Optional, Tuple @@ -94,9 +93,13 @@ def get_last_used_terminal_formatting(buf: str) -> str: return '\x1b' + buf.rsplit('\x1b', 1)[1].split('m')[0] + 'm' -def wait_return(): - print("Press Ctrl+C to send a SIGINT or use 'kill' command to send a SIGTERM") - signal.sigwait([signal.SIGINT, signal.SIGTERM]) +def wait_return() -> None: + if sys.platform != 'win32': + import signal + print("Press Ctrl+C to send a SIGINT or use 'kill' command to send a SIGTERM") + signal.sigwait([signal.SIGINT, signal.SIGTERM]) + else: + input('Press ENTER to exit>') UDID_ENV_VAR = 'PYMOBILEDEVICE3_UDID'