fix(plugin): add control socket, autostart_log=1, timeout-safe mangohudctl
This commit is contained in:
@@ -190,7 +190,8 @@ class Plugin:
|
||||
config_content = """\
|
||||
# DeckyVault MangoHud logging config
|
||||
output_folder=/tmp
|
||||
autostart_log=0
|
||||
control=mangohud
|
||||
autostart_log=1
|
||||
fps
|
||||
frame_timing
|
||||
cpu_power
|
||||
@@ -233,20 +234,17 @@ benchmark_percentiles=97,AVG,1,0.1
|
||||
return {"success": False, "error": str(e)}
|
||||
|
||||
async def stop_mangohud_logging(self) -> dict:
|
||||
"""RPC: Stop MangoHud logging via mangohudctl."""
|
||||
"""RPC: Stop MangoHud logging via mangohudctl. Best-effort, may fail if game already closed."""
|
||||
import subprocess
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["mangohudctl", "set", "log_session", "false"],
|
||||
capture_output=True, text=True, timeout=5
|
||||
capture_output=True, text=True, timeout=2
|
||||
)
|
||||
if result.returncode == 0:
|
||||
return {"success": True}
|
||||
else:
|
||||
return {"success": False, "error": result.stderr.strip() or "mangohudctl failed"}
|
||||
except FileNotFoundError:
|
||||
return {"success": False, "error": "mangohudctl not found. Is MangoHud running?"}
|
||||
except Exception as e:
|
||||
return {"success": False, "error": result.stderr.strip() or "mangohudctl failed"}
|
||||
except (subprocess.TimeoutExpired, FileNotFoundError, Exception) as e:
|
||||
return {"success": False, "error": str(e)}
|
||||
|
||||
async def _find_mangohud_log(self) -> str | None:
|
||||
|
||||
Reference in New Issue
Block a user