summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-07-19 10:17:39 +0300
committerLars Wirzenius <liw@liw.fi>2020-07-19 10:50:12 +0300
commitafb4c816cc713e27cf44334ddce3608a345a4356 (patch)
tree0dc6af49897c2f0d2f5ce1376a642951ce844f84
parent2ef29a95c40e7f6720fc54a3e985cc2e138eb162 (diff)
downloadewww-afb4c816cc713e27cf44334ddce3608a345a4356.tar.gz
refactor: use functions for starting/stopping daemons in ewww.py
-rw-r--r--ewww.py22
1 files changed, 2 insertions, 20 deletions
diff --git a/ewww.py b/ewww.py
index 4f06b47..3eb6e97 100644
--- a/ewww.py
+++ b/ewww.py
@@ -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.