From 40ce4e22750525939a5f91b667454e66186c36e2 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 3 Jul 2022 13:55:48 +0200 Subject: [PATCH] cleanup --- README.md | 3 +-- copyparty/util.py | 16 +++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index adfc39fd..d8550428 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,7 @@ turn your phone or raspi into a portable file server with resumable uploads/down * server only needs `py2.7` or `py3.3+`, all dependencies optional * browse/upload with [IE4](#browser-support) / netscape4.0 on win3.11 (heh) -* *resumable* uploads need `firefox 34+` / `chrome 41+` / `safari 7+` for full speed -* code standard: `black` +* *resumable* uploads need `firefox 34+` / `chrome 41+` / `safari 7+` try the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running from a basement in finland diff --git a/copyparty/util.py b/copyparty/util.py index 42af5d93..844f4add 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -1498,20 +1498,17 @@ def guess_mime(url: str, fallback: str = "application/octet-stream") -> str: def getalive(pids: list[int], pgid: int) -> list[int]: alive = [] for pid in pids: - if pgid: - try: + try: + if pgid: # check if still one of ours if os.getpgid(pid) == pgid: alive.append(pid) - except: - pass - else: - try: + else: # windows doesn't have pgroups; assume psutil.Process(pid) alive.append(pid) - except: - pass + except: + pass return alive @@ -1551,9 +1548,6 @@ def killtree(root: int) -> None: os.kill(pid, signal.SIGTERM) return - if not pids: - return # yay - for n in range(10): time.sleep(0.1) pids = getalive(pids, pgid)