diff --git a/server/lib/systant/command_executor.ex b/server/lib/systant/command_executor.ex index 60c8dc1..4dba27a 100644 --- a/server/lib/systant/command_executor.ex +++ b/server/lib/systant/command_executor.ex @@ -199,17 +199,25 @@ defmodule Systant.CommandExecutor do # Get current environment env = System.get_env() + # Ensure we have a proper PATH that includes system binaries + system_path = "/run/current-system/sw/bin:/usr/local/bin:/usr/bin:/bin" + current_path = Map.get(env, "PATH", "") + full_path = if current_path == "", do: system_path, else: "#{current_path}:#{system_path}" + + # Start with enhanced environment + enhanced_env = Map.put(env, "PATH", full_path) + # If running as root, add Wayland session environment for user commands if System.get_env("USER") == "root" do # Find the user's Wayland session info case find_user_wayland_session() do {:ok, wayland_env} -> - Map.merge(env, wayland_env) + Map.merge(enhanced_env, wayland_env) {:error, _reason} -> - env + enhanced_env end else - env + enhanced_env end end