summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-11-20 11:41:39 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2026-11-23 19:55:55 +0100
commit55f91677bbcaa4b29a09dfb5cfc0efe7d5e1ac5a (patch)
tree10009c26040b247e8dba7cc0a92f365c2af224ba /src/Run.hs
parent3423fd30cc430734fc85b417cc66644d17ae6443 (diff)
Spawn processes directly instead of via shell
Changelog: Test tool is now spawned directly without shell wrapper.
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Run.hs b/src/Run.hs
index 33c4109..b6613b4 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -367,11 +367,13 @@ runStep = \case
go node = do
env <- asks fst
let pname = ProcName tname
- tool = fromMaybe (teDefaultTool env) (lookup pname $ teProcTools env)
- cmd = T.unwords $ T.pack tool : map escape args
+ ( tool, cargs ) = fromMaybe ( "", [] ) $ uncons $ words $
+ fromMaybe (teDefaultTool env) (lookup pname $ teProcTools env)
+ args' = cargs ++ map T.unpack args
+ cmd = T.unwords $ T.pack tool : map escape (map T.pack args')
escape = ("'" <>) . (<> "'") . T.replace "'" "'\\''"
outProcName OutputChildExec pname cmd
- withProcess (Right node) pname killWith (T.unpack cmd) $ runStep . inner
+ withProcess (Right node) pname killWith tool args' $ runStep . inner
SpawnShell mbname node script inner -> do
let tname | Just (TypedVarName (VarName name)) <- mbname = name
@@ -429,7 +431,7 @@ withNetwork :: Network -> (Network -> TestRun a) -> TestRun a
withNetwork net inner = do
tcpdump <- asks (optTcpdump . teOptions . fst) >>= return . \case
Just path -> withProcess (Left net) ProcNameTcpdump (Just (Signal softwareTermination))
- (path ++ " -i br0 -w './br0.pcap' -U -Z root") . const
+ path [ "-i", "br0", "-w", "./br0.pcap", "-U", "-Z", "root" ] . const
Nothing -> id
tcpdump $ inner net