From 09fbd3b2cb359afcf0bfe5652f98be09b4835546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 27 Apr 2025 09:31:24 +0200 Subject: Preserve environment for spawn processes --- src/Process.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Process.hs b/src/Process.hs index 92bbab1..290aedf 100644 --- a/src/Process.hs +++ b/src/Process.hs @@ -23,6 +23,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as T import System.Directory +import System.Environment import System.Exit import System.FilePath import System.IO @@ -104,10 +105,11 @@ spawnOn target pname killWith cmd = do let netns = either getNetns getNetns target let prefix = T.unpack $ "ip netns exec \"" <> textNetnsName netns <> "\" " + currentEnv <- liftIO $ getEnvironment (Just hin, Just hout, Just herr, handle) <- liftIO $ createProcess (shell $ prefix ++ cmd') { std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe , cwd = Just (either netDir nodeDir target) - , env = Just [ ( "EREBOS_DIR", "." ) ] + , env = Just $ ( "EREBOS_DIR", "." ) : currentEnv } pout <- liftIO $ newTVarIO [] -- cgit v1.2.3