summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-05-15 20:20:25 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-05-15 20:20:25 +0200
commit338ac0efb3d2e2a258d949268ed6b27b3ecae1a0 (patch)
treed75471dbec089455c4f0c9539c0d38299cfe66c8 /src/Run.hs
parentbe0e2017b46e981060b1f9f5fd764571ad2dc2a1 (diff)
Extra arguments for the spawned tool
Changelog: Added `args` parameter to `spawn` command to pass extra command-line arguments to the spawend tool
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Run.hs b/src/Run.hs
index bc64721..329dc78 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -121,7 +121,7 @@ evalBlock (TestBlockStep prev step) = evalBlock prev >> case step of
DeclNode name net inner -> do
withNode net (Left name) $ evalBlock . inner
- Spawn tvname@(TypedVarName (VarName tname)) target inner -> do
+ Spawn tvname@(TypedVarName (VarName tname)) target args inner -> do
case target of
Left net -> withNode net (Right tvname) go
Right node -> go node
@@ -130,7 +130,9 @@ evalBlock (TestBlockStep prev step) = evalBlock prev >> case step of
opts <- asks $ teOptions . fst
let pname = ProcName tname
tool = fromMaybe (optDefaultTool opts) (lookup pname $ optProcTools opts)
- withProcess (Right node) pname Nothing tool $ evalBlock . inner
+ cmd = unwords $ tool : map (T.unpack . escape) args
+ escape = ("'" <>) . (<> "'") . T.replace "'" "'\\''"
+ withProcess (Right node) pname Nothing cmd $ evalBlock . inner
SpawnShell mbname node script inner -> do
let tname | Just (TypedVarName (VarName name)) <- mbname = name