summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-04-05 11:47:12 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-04-05 12:33:39 +0200
commite06402099ce256405610d0be64760266f969dcd0 (patch)
tree1c1e10ba0aa2f6dbf9ca04c77a9ad0b8122645ad /src/Run.hs
parentad00b4534582c5ce94243f7dda3b76d7c0bba021 (diff)
Custom signals to kill spawned processHEADmaster
Changelog: Added `killwith` clause to set a signal used to terminate `spawn`ed process.
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Run.hs b/src/Run.hs
index 8a95daf..a23b254 100644
--- a/src/Run.hs
+++ b/src/Run.hs
@@ -38,6 +38,7 @@ import Network.Ip
import Output
import Parser
import Process
+import Process.Signal
import Run.Monad
import Sandbox
import Script.Expr
@@ -185,7 +186,7 @@ runStep = \case
DeclNode name net inner -> do
withNode net (Left name) $ runStep . inner
- Spawn tvname@(TypedVarName (VarName tname)) target args inner -> do
+ Spawn tvname@(TypedVarName (VarName tname)) target args killWith inner -> do
case target of
Left net -> withNode net (Right tvname) go
Right node -> go node
@@ -197,7 +198,7 @@ runStep = \case
cmd = T.unwords $ T.pack tool : map escape args
escape = ("'" <>) . (<> "'") . T.replace "'" "'\\''"
outProcName OutputChildExec pname cmd
- withProcess (Right node) pname Nothing (T.unpack cmd) $ runStep . inner
+ withProcess (Right node) pname killWith (T.unpack cmd) $ runStep . inner
SpawnShell mbname node script inner -> do
let tname | Just (TypedVarName (VarName name)) <- mbname = name
@@ -254,7 +255,7 @@ withSubnet parent tvname inner = do
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 softwareTermination)
+ Just path -> withProcess (Left net) ProcNameTcpdump (Just (Signal softwareTermination))
(path ++ " -i br0 -w './br0.pcap' -U -Z root") . const
Nothing -> id