summaryrefslogtreecommitdiff
path: root/src/Script
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-05-31 16:54:42 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2025-05-31 16:54:42 +0200
commit17fb83b2289f527d4242a7b66df963b56f850f2e (patch)
treeb64d549ddc4e681471d8f89ea6cae5faea89907e /src/Script
parent3a314a0b236d975033a329e98c27e9f35677e2df (diff)
Print source line of shell command failureHEADmaster
Diffstat (limited to 'src/Script')
-rw-r--r--src/Script/Shell.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Script/Shell.hs b/src/Script/Shell.hs
index 8f25ab5..b00dc5f 100644
--- a/src/Script/Shell.hs
+++ b/src/Script/Shell.hs
@@ -23,18 +23,20 @@ import Network
import Output
import Process
import Run.Monad
+import Script.Var
data ShellStatement = ShellStatement
{ shellCommand :: Text
, shellArguments :: [ Text ]
+ , shellSourceLine :: SourceLine
}
newtype ShellScript = ShellScript [ ShellStatement ]
executeScript :: Node -> ProcName -> MVar ExitCode -> Handle -> Handle -> Handle -> ShellScript -> TestRun ()
-executeScript node _ statusVar pstdin pstdout pstderr (ShellScript statements) = do
+executeScript node pname statusVar pstdin pstdout pstderr (ShellScript statements) = do
forM_ statements $ \ShellStatement {..} -> case shellCommand of
"echo" -> liftIO $ do
T.hPutStrLn pstdout $ T.intercalate " " shellArguments
@@ -51,6 +53,7 @@ executeScript node _ statusVar pstdin pstdout pstderr (ShellScript statements) =
liftIO (waitForProcess phandle) >>= \case
ExitSuccess -> return ()
status -> do
+ outLine OutputChildFail (Just $ textProcName pname) $ "failed at: " <> textSourceLine shellSourceLine
liftIO $ putMVar statusVar status
throwError Failed
liftIO $ putMVar statusVar ExitSuccess