pms-infra-cmdrun 0.0.8.0 → 0.0.9.0
raw patch · 3 files changed
+14/−14 lines, 3 files
Files
- CHANGELOG.md +4/−0
- pms-infra-cmdrun.cabal +1/−1
- src/PMS/Infra/CmdRun/DS/Core.hs +9/−13
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for pms-infra-cmdrun +## 0.0.9.0 -- 2026-04-30++* Support timeout configuration.+ ## 0.0.8.0 -- 2025-09-23 * Support base64 image tool response.
pms-infra-cmdrun.cabal view
@@ -20,7 +20,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.0.8.0+version: 0.0.9.0 -- A short (one-line) description of the package. synopsis: pms-infra-cmdrun
src/PMS/Infra/CmdRun/DS/Core.hs view
@@ -142,11 +142,13 @@ STM.atomically $ STM.writeTQueue resQ res + -- | -- genCmdRunTask :: DM.DefaultCmdRunCommandData -> AppContext (IOTask ()) genCmdRunTask dat = do toolsDir <- view DM.toolsDirDomainData <$> lift ask+ tout <- view DM.timeoutMicrosecDomainData <$> lift ask resQ <- view DM.responseQueueDomainData <$> lift ask invalidChars <- view DM.invalidCharsDomainData <$> lift ask invalidCmds <- view DM.invalidCmdsDomainData <$> lift ask@@ -165,23 +167,22 @@ let cmd = "\"" ++ toolsDir </> name ++ scriptExt ++ "\" " ++ argsStr $logDebugS DM._LOGTAG $ T.pack $ "cmdRunTask: system cmd. " ++ cmd- return $ cmdRunTask resQ dat cmd + return $ cmdRunTask resQ dat cmd tout + -- | -- -cmdRunTask :: STM.TQueue DM.McpResponse -> DM.DefaultCmdRunCommandData -> String -> IOTask ()-cmdRunTask resQ cmdDat cmd = flip E.catchAny errHdl $ do- hPutStrLn stderr $ "[INFO] PMS.Infra.CmdRun.DS.Core.work.cmdRunTask run. " ++ cmd- let tout = 30 * 1000 * 1000---- race (readCreateProcessWithExitCode (shell cmd) "") (CC.threadDelay tout) >>= \case+cmdRunTask :: STM.TQueue DM.McpResponse -> DM.DefaultCmdRunCommandData -> String -> Int -> IO ()+cmdRunTask resQ cmdDat cmd tout = flip E.catchAny errHdl $ do+ hPutStrLn stderr $ "[INFO] PMS.Infra.CmdRun.DS.Core.work.cmdRunTask.run cmd: " ++ cmd+ race (runCommandBS cmd) (CC.threadDelay tout) >>= \case Left (code, out, err) -> response code out err Right _ -> E.throwString "timeout occurred." hPutStrLn stderr "[INFO] PMS.Infra.CmdRun.DS.Core.work.cmdRunTask end."-+ where errHdl :: E.SomeException -> IO () errHdl e = response (ExitFailure 1) "" $ TE.encodeUtf8 . T.pack $ show e@@ -201,11 +202,6 @@ DM.McpToolsCallResponseResultContent "text" outStr , DM.McpToolsCallResponseResultContent "text" errStr ]-- -- content = [- -- "{\"type\":\"text\",\"text\":\"" ++ outStr ++ "\"}"- -- , "{\"type\":\"text\",\"text\":\"" ++ errStr ++ "\"}"- -- ] result = DM.McpToolsCallResponseResult { DM._contentMcpToolsCallResponseResult = content