{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE NoImplicitPrelude #-} module Control.Process.Process( module Process , readCreateProcessWithExitCode , readProcessWithExitCode , waitForProcess , getProcessExitCode ) where import Control.Applicative ( Applicative(pure) ) import Control.Category ( Category((.)) ) import Control.Exitcode ( ExitcodeT0, fromExitCode', liftExitcode, ExitcodeT1, _Exitcode1, hoistExitcode ) import Control.Lens ( Identity(runIdentity), set ) import Control.Monad ( Monad((>>=)) ) import Data.String ( String ) import System.FilePath( FilePath ) import System.IO ( IO ) import System.Process as Process( createProcess , createProcess_ , shell , proc , CreateProcess() , CmdSpec(..) , StdStream(..) , ProcessHandle , callProcess , callCommand , spawnProcess , readCreateProcess , readProcess , withCreateProcess , cleanupProcess , showCommandForUser , Pid , getPid , getCurrentPid , terminateProcess , interruptProcessGroupOf , createPipe , createPipeFd ) import qualified System.Process as P(readCreateProcessWithExitCode, readProcessWithExitCode, waitForProcess, getProcessExitCode) import Control.Monad.Trans.Maybe ( MaybeT(MaybeT) ) readCreateProcessWithExitCode :: CreateProcess -> String -> ExitcodeT1 IO (String, String) readCreateProcessWithExitCode :: CreateProcess -> String -> ExitcodeT1 IO (String, String) readCreateProcessWithExitCode CreateProcess p String a = forall (f :: * -> *) a e. Functor f => f a -> ExitcodeT f e a liftExitcode (CreateProcess -> String -> IO (ExitCode, String, String) P.readCreateProcessWithExitCode CreateProcess p String a) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= \(ExitCode x, String y, String z) -> forall (f :: * -> *) (g :: * -> *) e a. (forall x. f x -> g x) -> ExitcodeT f e a -> ExitcodeT g e a hoistExitcode (forall (f :: * -> *) a. Applicative f => a -> f a pure forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . forall a. Identity a -> a runIdentity) (forall s t a b. ASetter s t a b -> b -> s -> t set forall a a'. Lens (Exitcode1 a) (Exitcode1 a') a a' _Exitcode1 (String y, String z) (ExitCode -> Exitcode0 fromExitCode' ExitCode x)) readProcessWithExitCode :: FilePath -> [String] -> String -> ExitcodeT1 IO (String, String) readProcessWithExitCode :: String -> [String] -> String -> ExitcodeT1 IO (String, String) readProcessWithExitCode String p [String] a String i = forall (f :: * -> *) a e. Functor f => f a -> ExitcodeT f e a liftExitcode (String -> [String] -> String -> IO (ExitCode, String, String) P.readProcessWithExitCode String p [String] a String i) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= \(ExitCode x, String y, String z) -> forall (f :: * -> *) (g :: * -> *) e a. (forall x. f x -> g x) -> ExitcodeT f e a -> ExitcodeT g e a hoistExitcode (forall (f :: * -> *) a. Applicative f => a -> f a pure forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . forall a. Identity a -> a runIdentity) (forall s t a b. ASetter s t a b -> b -> s -> t set forall a a'. Lens (Exitcode1 a) (Exitcode1 a') a a' _Exitcode1 (String y, String z) (ExitCode -> Exitcode0 fromExitCode' ExitCode x)) waitForProcess :: ProcessHandle -> ExitcodeT0 IO waitForProcess :: ProcessHandle -> ExitcodeT0 IO waitForProcess ProcessHandle h = forall (f :: * -> *) a e. Functor f => f a -> ExitcodeT f e a liftExitcode (ProcessHandle -> IO ExitCode P.waitForProcess ProcessHandle h) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= \ExitCode x -> forall (f :: * -> *) (g :: * -> *) e a. (forall x. f x -> g x) -> ExitcodeT f e a -> ExitcodeT g e a hoistExitcode (forall (f :: * -> *) a. Applicative f => a -> f a pure forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . forall a. Identity a -> a runIdentity) (ExitCode -> Exitcode0 fromExitCode' ExitCode x) getProcessExitCode :: ProcessHandle -> ExitcodeT0 (MaybeT IO) getProcessExitCode :: ProcessHandle -> ExitcodeT0 (MaybeT IO) getProcessExitCode ProcessHandle h = forall (f :: * -> *) a e. Functor f => f a -> ExitcodeT f e a liftExitcode (forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a MaybeT (ProcessHandle -> IO (Maybe ExitCode) P.getProcessExitCode ProcessHandle h)) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b >>= forall (f :: * -> *) (g :: * -> *) e a. (forall x. f x -> g x) -> ExitcodeT f e a -> ExitcodeT g e a hoistExitcode (forall (f :: * -> *) a. Applicative f => a -> f a pure forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . forall a. Identity a -> a runIdentity) forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . ExitCode -> Exitcode0 fromExitCode'