This commit is contained in:
ryan 2025-08-10 20:52:03 -07:00
parent 0677fe39dd
commit ddec7ebe50
2 changed files with 14 additions and 2 deletions

View File

@ -79,6 +79,10 @@ in
SYSTANT_PUBLISH_INTERVAL = toString cfg.publishInterval;
# Override RELEASE_COOKIE to bypass file reading
RELEASE_COOKIE = "systant-bypass-cookie";
# Set proper PATH for NixOS
PATH = "/run/current-system/sw/bin:/run/wrappers/bin:\${PATH}";
# Set log level to debug for troubleshooting
SYSTANT_LOG_LEVEL = "debug";
};
serviceConfig = {

View File

@ -253,10 +253,18 @@ defmodule Systant.CommandExecutor do
env = build_command_environment()
Logger.info("Executing system command: #{inspect(final_command)} (timeout: #{timeout}ms)")
Logger.debug("Environment PATH: #{Map.get(env, "PATH")}")
Logger.debug("Environment USER: #{Map.get(env, "USER")}")
Logger.debug("Environment HOME: #{Map.get(env, "HOME")}")
Logger.debug("Environment XDG_RUNTIME_DIR: #{Map.get(env, "XDG_RUNTIME_DIR")}")
try do
case System.cmd(List.first(final_command), Enum.drop(final_command, 1),
stderr_to_stdout: true, timeout: timeout, env: env) do
task = Task.async(fn ->
System.cmd(List.first(final_command), Enum.drop(final_command, 1),
stderr_to_stdout: true, env: env)
end)
case Task.await(task, timeout) do
{output, 0} ->
execution_time = System.monotonic_time(:millisecond) - start_time
Logger.info("Command completed successfully in #{execution_time}ms")