{-# LANGUAGE CPP #-}
module System.Process.Lens.ProcessHandler
(
ProcessHandler(..)
, _Handler
, hstdin
, hstdout
, hstderr
, hhandle
, defaultCreateProcess
) where
import Control.Lens
import System.IO
import System.Process
data ProcessHandler =
ProcessHandler
{ _hstdin :: Maybe Handle
, _hstdout :: Maybe Handle
, _hstderr :: Maybe Handle
, _hhandle :: ProcessHandle
}
hstdin :: Lens' ProcessHandler (Maybe Handle)
hstdin = lens _hstdin (\t b -> t { _hstdin = b })
hstdout :: Lens' ProcessHandler (Maybe Handle)
hstdout = lens _hstdout (\t b -> t { _hstdout = b })
hstderr :: Lens' ProcessHandler (Maybe Handle)
hstderr = lens _hstderr (\t b -> t { _hstderr = b })
hhandle :: Lens' ProcessHandler ProcessHandle
hhandle = lens _hhandle (\t b -> t { _hhandle = b })
_Handler :: Iso' ProcessHandler (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
_Handler = iso
(\(ProcessHandler a b c p) -> (a,b,c,p))
(\(a,b,c,p) -> ProcessHandler a b c p)
defaultCreateProcess :: CreateProcess
defaultCreateProcess =
CreateProcess
{ cmdspec = ShellCommand ""
, cwd = Nothing
, env = Nothing
, std_in = Inherit
, std_out = Inherit
, std_err = Inherit
, close_fds = False
, create_group = False
, delegate_ctlc = False
, new_session = False
#if MIN_VERSION_process(1, 3, 0)
, detach_console = False
, create_new_console = False
#endif
#if MIN_VERSION_process(1, 4, 0)
, child_group = Nothing
, child_user = Nothing
#endif
#if MIN_VERSION_process(1, 5, 0)
, use_process_jobs = False
#endif
}