Skip to content

Commit 4c8ee3b

Browse files
committed
feat(api): kill adb on exit
1 parent 51dd64e commit 4c8ee3b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

api/autoafk/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
import sys
33

44

5+
IS_PROD = bool(getattr(sys, "_MEIPASS", False))
56
SRC_DIR = os.path.dirname(os.path.abspath(__file__))
67
project_dir = getattr(sys, "_MEIPASS", os.path.split(SRC_DIR)[0])

api/autoafk/tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from com.dtmilano.android.viewclient import ViewClient
1515
from PIL import Image
1616

17-
from autoafk import project_dir, settings, SRC_DIR
17+
from autoafk import IS_PROD, project_dir, settings, SRC_DIR
1818
from autoafk.logger import logger
1919

2020

@@ -101,7 +101,8 @@ def _start_adb_server() -> None:
101101
def kill_adb_server() -> None:
102102
subprocess.run([adb_path, "kill-server"], capture_output=True, text=True)
103103

104-
# atexit.register(kill_adb_server)
104+
if IS_PROD:
105+
atexit.register(kill_adb_server)
105106

106107

107108
def _is_correct_resolution(dims: tuple[int, int]) -> bool:

0 commit comments

Comments
 (0)