Skip to content

Commit

Permalink
systemd/launchd: work around when promnesia binary isn't available in…
Browse files Browse the repository at this point in the history
… PATH, use sys.executable

should resolve #433
  • Loading branch information
karlicoss committed Oct 21, 2024
1 parent e6cbc18 commit 9366195
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/promnesia/misc/install_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import argparse
import os
import platform
import shutil
import sys
import time
from pathlib import Path
Expand Down Expand Up @@ -114,14 +113,16 @@ def install(args: argparse.Namespace) -> None:
print(f"Writing launch script to {out}", file=sys.stderr)

# ugh. we want to know whether we're invoked 'properly' as an executable or ad-hoc via scripts/promnesia
extra_exe: list[str] = []
if os.environ.get('DIRTY_RUN') is not None:
launcher = str(root() / 'scripts/promnesia')
else:
exe = shutil.which('promnesia'); assert exe is not None
launcher = exe # older systemd wants absolute paths..
launcher = sys.executable
extra_exe = ['-m', 'promnesia']

db = args.db
largs = [
*extra_exe,
'serve',
*([] if db is None else ['--db', str(db)]),
'--timezone', args.timezone,
Expand Down

0 comments on commit 9366195

Please sign in to comment.