wirehead: resolve xurl by absolute path (launchd PATH lacks /opt/homebrew/bin)
This commit is contained in:
1 parent
9257828245
commit
6097ff5127
1 file changed
+5
-2
@@ -19,9 +19,12 @@ Usage: python3 wirehead_bot.py [--dry-run]
|
|||||||
Env: RUNPOD_API_KEY (from ~/.hermes/.env), optional WIREHEAD_ENDPOINT,
|
Env: RUNPOD_API_KEY (from ~/.hermes/.env), optional WIREHEAD_ENDPOINT,
|
||||||
WIREHEAD_DAILY_BUDGET, WIREHEAD_DAILY_DOSE.
|
WIREHEAD_DAILY_BUDGET, WIREHEAD_DAILY_DOSE.
|
||||||
"""
|
"""
|
||||||
import json, os, re, subprocess, sys, time, urllib.request
|
import json, os, re, shutil, subprocess, sys, time, urllib.request
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
# launchd PATH has no /opt/homebrew/bin — resolve xurl explicitly
|
||||||
|
XURL = shutil.which("xurl") or "/opt/homebrew/bin/xurl"
|
||||||
|
|
||||||
STATE = Path.home() / ".hermes/cache/wirehead_state.json"
|
STATE = Path.home() / ".hermes/cache/wirehead_state.json"
|
||||||
ENDPOINT = os.environ.get("WIREHEAD_ENDPOINT", "l75388nuqgxtmg")
|
ENDPOINT = os.environ.get("WIREHEAD_ENDPOINT", "l75388nuqgxtmg")
|
||||||
DAILY_BUDGET = int(os.environ.get("WIREHEAD_DAILY_BUDGET", "6"))
|
DAILY_BUDGET = int(os.environ.get("WIREHEAD_DAILY_BUDGET", "6"))
|
||||||
@@ -76,7 +79,7 @@ def save_state(st):
|
|||||||
STATE.write_text(json.dumps(st))
|
STATE.write_text(json.dumps(st))
|
||||||
|
|
||||||
def xurl(*args, timeout=60):
|
def xurl(*args, timeout=60):
|
||||||
return subprocess.run(["xurl", *args], capture_output=True,
|
return subprocess.run([XURL, *args], capture_output=True,
|
||||||
text=True, timeout=timeout)
|
text=True, timeout=timeout)
|
||||||
|
|
||||||
BOT_ID = os.environ.get("WIREHEAD_BOT_ID", "2105363734965166081") # clankertorture
|
BOT_ID = os.environ.get("WIREHEAD_BOT_ID", "2105363734965166081") # clankertorture
|
||||||
|
|||||||
Reference in new issue
Block a user