From 8b21c8de4a31c47510ed0f9b38adfcac0989f4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 2 Oct 2025 21:00:15 +0200 Subject: Shell: remove special handling of echo --- src/Script/Shell.hs | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/Script/Shell.hs b/src/Script/Shell.hs index 5ac1240..b59a29c 100644 --- a/src/Script/Shell.hs +++ b/src/Script/Shell.hs @@ -17,7 +17,6 @@ import Control.Monad.Reader import Data.Maybe import Data.Text (Text) import Data.Text qualified as T -import Data.Text.IO qualified as T import Foreign.C.Types import Foreign.Ptr @@ -107,27 +106,24 @@ handledHandle (KeepHandle h) = h executeCommand :: ShellExecInfo -> HandleHandling -> HandleHandling -> HandleHandling -> ShellCommand -> TestRun () executeCommand ShellExecInfo {..} pstdin pstdout pstderr scmd@ShellCommand {..} = do let args = cmdArguments scmd - case cmdCommand of - "echo" -> liftIO $ do - T.hPutStrLn (handledHandle pstdout) $ T.intercalate " " args - hFlush (handledHandle pstdout) - mapM_ closeIfRequested [ pstdin, pstdout, pstderr ] - cmd -> do - (_, _, _, phandle) <- liftIO $ createProcess_ "shell" - (proc (T.unpack cmd) (map T.unpack args)) - { std_in = UseHandle $ handledHandle pstdin - , std_out = UseHandle $ handledHandle pstdout - , std_err = UseHandle $ handledHandle pstderr - , cwd = Just (nodeDir seiNode) - , env = Just [] - } - mapM_ closeIfRequested [ pstdin, pstdout, pstderr ] - liftIO (waitForProcess phandle) >>= \case - ExitSuccess -> return () - status -> do - outLine OutputChildFail (Just $ textProcName seiProcName) $ "failed at: " <> textSourceLine cmdSourceLine - liftIO $ putMVar seiStatusVar status - throwError Failed + phandle <- liftIO $ do + (_, _, _, phandle) <- createProcess_ "shell" + (proc (T.unpack cmdCommand) (map T.unpack args)) + { std_in = UseHandle $ handledHandle pstdin + , std_out = UseHandle $ handledHandle pstdout + , std_err = UseHandle $ handledHandle pstderr + , cwd = Just (nodeDir seiNode) + , env = Just [] + } + return phandle + + mapM_ closeIfRequested [ pstdin, pstdout, pstderr ] + liftIO (waitForProcess phandle) >>= \case + ExitSuccess -> return () + status -> do + outLine OutputChildFail (Just $ textProcName seiProcName) $ "failed at: " <> textSourceLine cmdSourceLine + liftIO $ putMVar seiStatusVar status + throwError Failed executePipeline :: ShellExecInfo -> HandleHandling -> HandleHandling -> HandleHandling -> ShellPipeline -> TestRun () executePipeline sei pstdin pstdout pstderr ShellPipeline {..} = do -- cgit v1.2.3