Skip to content

Commit

Permalink
feat(api): kill adb on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
aentwist committed Jul 16, 2024
1 parent 51dd64e commit 4c8ee3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/autoafk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
import sys


IS_PROD = bool(getattr(sys, "_MEIPASS", False))
SRC_DIR = os.path.dirname(os.path.abspath(__file__))
project_dir = getattr(sys, "_MEIPASS", os.path.split(SRC_DIR)[0])
5 changes: 3 additions & 2 deletions api/autoafk/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from com.dtmilano.android.viewclient import ViewClient
from PIL import Image

from autoafk import project_dir, settings, SRC_DIR
from autoafk import IS_PROD, project_dir, settings, SRC_DIR
from autoafk.logger import logger


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

# atexit.register(kill_adb_server)
if IS_PROD:
atexit.register(kill_adb_server)


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

0 comments on commit 4c8ee3b

Please sign in to comment.