Fix command executor
This commit is contained in:
parent
983fc1cd29
commit
0677fe39dd
@ -199,17 +199,25 @@ defmodule Systant.CommandExecutor do
|
|||||||
# Get current environment
|
# Get current environment
|
||||||
env = System.get_env()
|
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 running as root, add Wayland session environment for user commands
|
||||||
if System.get_env("USER") == "root" do
|
if System.get_env("USER") == "root" do
|
||||||
# Find the user's Wayland session info
|
# Find the user's Wayland session info
|
||||||
case find_user_wayland_session() do
|
case find_user_wayland_session() do
|
||||||
{:ok, wayland_env} ->
|
{:ok, wayland_env} ->
|
||||||
Map.merge(env, wayland_env)
|
Map.merge(enhanced_env, wayland_env)
|
||||||
{:error, _reason} ->
|
{:error, _reason} ->
|
||||||
env
|
enhanced_env
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
env
|
enhanced_env
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user