summaryrefslogtreecommitdiff
path: root/subplot/ewww.py
diff options
context:
space:
mode:
Diffstat (limited to 'subplot/ewww.py')
-rw-r--r--subplot/ewww.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/subplot/ewww.py b/subplot/ewww.py
index a6c4c4f..11915ae 100644
--- a/subplot/ewww.py
+++ b/subplot/ewww.py
@@ -10,12 +10,6 @@ import urllib.parse
import yaml
-# Name of Rust binary, debug-build.
-def _binary(name):
- srcdir = globals()["srcdir"]
- return os.path.abspath(os.path.join(srcdir, "target", "debug", name))
-
-
# Write a file with given content.
def _write(filename, content):
open(filename, "w").write(content)
@@ -59,6 +53,7 @@ def copy_test_certificate(ctx, cert=None, key=None):
# Start server using named configuration file.
def start_server(ctx, filename=None):
get_file = globals()["get_file"]
+ srcdir = globals()["srcdir"]
daemon_start_on_port = globals()["daemon_start_on_port"]
logging.debug(f"Starting ewww with config file {filename}")
@@ -72,9 +67,10 @@ def start_server(ctx, filename=None):
config = yaml.safe_dump(config)
_write(filename, config)
- daemon_start_on_port(
- ctx, path=_binary("ewww"), args=filename, name="ewww", port=port
- )
+ target = os.environ.get("CARGO_TARGET_DIR", os.path.join(srcdir, "target"))
+ logging.debug(f"Cargo target directory: {target}")
+ binary = os.path.join(target, "debug", "ewww")
+ daemon_start_on_port(ctx, binary, args=filename, name="ewww", port=port)
# Stop previously started server.