Skip to content

Commit

Permalink
add runCmd' following callProcess' model
Browse files Browse the repository at this point in the history
  • Loading branch information
rvion committed Nov 25, 2015
1 parent 9f73304 commit 02593ba
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/System/Process/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

module System.Process.Run
(runCmd
,runCmd'
,callProcess
,callProcess'
,ProcessExitedUnsuccessfully)
Expand Down Expand Up @@ -39,8 +40,16 @@ runCmd :: forall (m :: * -> *).
=> CMD
-> Maybe Text -- ^ optional additional error message
-> m ()
runCmd cmd@(CMD{..}) mbErrMsg = do
result <- try (callProcess cmd)
runCmd = runCmd' id

runCmd' :: forall (m :: * -> *).
(MonadLogger m,MonadIO m,MonadBaseControl IO m)
=> (CreateProcess -> CreateProcess)
-> CMD
-> Maybe Text -- ^ optional additional error message
-> m ()
runCmd' modCP cmd@(CMD{..}) mbErrMsg = do
result <- try (callProcess' modCP cmd)
case result of
Left (ProcessExitedUnsuccessfully _ ec) -> do
$logError $
Expand Down

0 comments on commit 02593ba

Please sign in to comment.