on master help sign in
Add logged version of readCreateProcessWithExitCode
commitd9cc47d55cc0b6b40c7c223d8b9757f7b864a5dd authorTom Smalley <tfsmalley@gmail.com> dateFri 19 Oct 2018, 14:08 (8 years ago) parent6298293
2 files changed+9
lib/cliapp/src/Obelisk/CliApp.hs+1 lib/cliapp/src/Obelisk/CliApp/Process.hs+8
lib/cliapp/src/Obelisk/CliApp.hs+1
@@ -37,6 +37,7 @@ module Obelisk.CliApp
3737 , AsProcessFailure (..)
3838 , readProcessAndLogStderr
3939 , readProcessAndLogOutput
40+ , readCreateProcessWithExitCode
4041 , callProcessAndLogOutput
4142 , createProcess_
4243 , callProcess
lib/cliapp/src/Obelisk/CliApp/Process.hs+8
@@ -13,6 +13,7 @@ module Obelisk.CliApp.Process
1313 , AsProcessFailure (..)
1414 , readProcessAndLogStderr
1515 , readProcessAndLogOutput
16+ , readCreateProcessWithExitCode
1617 , callProcessAndLogOutput
1718 , createProcess
1819 , createProcess_
@@ -65,6 +66,13 @@ readProcessAndLogStderr sev process = do
6566 streamToLog =<< liftIO (streamHandle sev err)
6667 liftIO $ T.decodeUtf8 <$> BS.hGetContents out
6768
69+readCreateProcessWithExitCode
70+ :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e)
71+ => CreateProcess -> m (ExitCode, String, String)
72+readCreateProcessWithExitCode process = do
73+ putLog Debug $ "Creating process: " <> reconstructCommand (cmdspec process)
74+ liftIO $ Process.readCreateProcessWithExitCode process ""
75+
6876-- | Like `System.Process.readProcess` but logs the combined output (stdout and stderr)
6977-- with the corresponding severity.
7078--