mirror of
https://github.com/9001/copyparty.git
synced 2025-10-03 17:59:19 +02:00
ensure OS signals hit main-thread as intended;
use sigmasks to block SIGINT, SIGTERM, SIGUSR1 from all other threads also initiate shutdown by calling sighandler directly, in case this misses anything and that is still unreliable (discovered by `--exit=idx` being noop once in a blue moon)
This commit is contained in:
parent
2c92dab165
commit
87c60a1ec9
10 changed files with 63 additions and 43 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# coding: latin-1
|
||||
from __future__ import print_function, unicode_literals
|
||||
import re, os, sys, time, shutil, signal, threading, tarfile, hashlib, platform, tempfile, traceback
|
||||
import re, os, sys, time, shutil, signal, tarfile, hashlib, platform, tempfile, traceback
|
||||
import subprocess as sp
|
||||
|
||||
|
||||
|
@ -368,17 +368,6 @@ def get_payload():
|
|||
p = a
|
||||
|
||||
|
||||
def utime(top):
|
||||
# avoid cleaners
|
||||
files = [os.path.join(dp, p) for dp, dd, df in os.walk(top) for p in dd + df]
|
||||
while True:
|
||||
t = int(time.time())
|
||||
for f in [top] + files:
|
||||
os.utime(f, (t, t))
|
||||
|
||||
time.sleep(78123)
|
||||
|
||||
|
||||
def confirm(rv):
|
||||
msg()
|
||||
msg("retcode", rv if rv else traceback.format_exc())
|
||||
|
@ -398,9 +387,7 @@ def run(tmp, j2, ftp):
|
|||
msg("sfxdir:", tmp)
|
||||
msg()
|
||||
|
||||
t = threading.Thread(target=utime, args=(tmp,), name="utime")
|
||||
t.daemon = True
|
||||
t.start()
|
||||
sys.argv.append("--sfx-tpoke=" + tmp)
|
||||
|
||||
ld = (("", ""), (j2, "j2"), (ftp, "ftp"), (not PY2, "py2"), (PY37, "py37"))
|
||||
ld = [os.path.join(tmp, b) for a, b in ld if not a]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue