diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-07-19 10:17:39 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-07-19 10:50:12 +0300 |
commit | afb4c816cc713e27cf44334ddce3608a345a4356 (patch) | |
tree | 0dc6af49897c2f0d2f5ce1376a642951ce844f84 /ewww.py | |
parent | 2ef29a95c40e7f6720fc54a3e985cc2e138eb162 (diff) | |
download | ewww-afb4c816cc713e27cf44334ddce3608a345a4356.tar.gz |
refactor: use functions for starting/stopping daemons in ewww.py
Diffstat (limited to 'ewww.py')
-rw-r--r-- | ewww.py | 22 |
1 files changed, 2 insertions, 20 deletions
@@ -83,30 +83,12 @@ def start_server(ctx, filename=None): config = yaml.safe_dump(config) _write(filename, config) - _run( - ctx, - [ - "/usr/sbin/daemonize", - "-c", - os.getcwd(), - "-p", - "ewww.pid", - "-o", - "ewww.stdout", - "-e", - "ewww.stderr", - _binary("ewww"), - filename, - ], - ) - _run_exit(ctx, 0) - - ctx["pid"] = int(open("ewww.pid").read().strip()) + start_daemon(ctx, "ewww", [_binary("ewww"), filename]) # Stop previously started server. def stop_server(ctx): - os.kill(ctx["pid"], signal.SIGKILL) + stop_daemon(ctx, "ewww") # Make a HTTP request. |