Make sigterm listen optional (fixes macOS problem)

This commit is contained in:
shortcutme 2019-02-16 23:48:18 +01:00
parent 952a1a1da8
commit c92c840c41
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 4 additions and 2 deletions

View File

@ -12,9 +12,11 @@ def main():
main = None
try:
import signal
try:
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(0))
except Exception as err:
print("Error setting up SIGTERM watcher: %s" % err)
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(0))
app_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(app_dir) # Change working dir to zeronet.py dir
sys.path.insert(0, os.path.join(app_dir, "src/lib")) # External liblary directory