This commit is contained in:
ed 2022-07-03 13:55:48 +02:00
parent 8fef9e363e
commit 40ce4e2275
2 changed files with 6 additions and 13 deletions

View file

@ -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 * server only needs `py2.7` or `py3.3+`, all dependencies optional
* browse/upload with [IE4](#browser-support) / netscape4.0 on win3.11 (heh) * browse/upload with [IE4](#browser-support) / netscape4.0 on win3.11 (heh)
* *resumable* uploads need `firefox 34+` / `chrome 41+` / `safari 7+` for full speed * *resumable* uploads need `firefox 34+` / `chrome 41+` / `safari 7+`
* code standard: `black`
try the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running from a basement in finland try the **[read-only demo server](https://a.ocv.me/pub/demo/)** 👀 running from a basement in finland

View file

@ -1498,20 +1498,17 @@ def guess_mime(url: str, fallback: str = "application/octet-stream") -> str:
def getalive(pids: list[int], pgid: int) -> list[int]: def getalive(pids: list[int], pgid: int) -> list[int]:
alive = [] alive = []
for pid in pids: for pid in pids:
if pgid: try:
try: if pgid:
# check if still one of ours # check if still one of ours
if os.getpgid(pid) == pgid: if os.getpgid(pid) == pgid:
alive.append(pid) alive.append(pid)
except: else:
pass
else:
try:
# windows doesn't have pgroups; assume # windows doesn't have pgroups; assume
psutil.Process(pid) psutil.Process(pid)
alive.append(pid) alive.append(pid)
except: except:
pass pass
return alive return alive
@ -1551,9 +1548,6 @@ def killtree(root: int) -> None:
os.kill(pid, signal.SIGTERM) os.kill(pid, signal.SIGTERM)
return return
if not pids:
return # yay
for n in range(10): for n in range(10):
time.sleep(0.1) time.sleep(0.1)
pids = getalive(pids, pgid) pids = getalive(pids, pgid)