blob: d25d2a24cae098acdd332dfa2cd2c0f9c678c036 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
{- Running processes in the foreground, not via the concurrent-output
- layer.
-
- Avoid using this in propellor properties!
-
- Copyright 2016 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.Process.NonConcurrent where
import System.Process
import System.Exit
import System.IO
import Utility.SafeCommand
import Control.Applicative
import Prelude
boolSystemNonConcurrent :: String -> [CommandParam] -> IO Bool
boolSystemNonConcurrent cmd params = do
(Nothing, Nothing, Nothing, p) <- createProcessNonConcurrent $
proc cmd (toCommand params)
dispatch <$> waitForProcessNonConcurrent p
where
dispatch ExitSuccess = True
dispatch _ = False
createProcessNonConcurrent :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
createProcessNonConcurrent = createProcess
waitForProcessNonConcurrent :: ProcessHandle -> IO ExitCode
waitForProcessNonConcurrent = waitForProcess
|