{-# LANGUAGE CPP #-}
module System.Process.Microlens.ProcessHandler
(
ProcessHandler(..)
, hstdin
, hstdout
, hstderr
, hhandle
, _Handler
, defaultCreateProcess
) where
import Lens.Micro
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 :: Lens' ProcessHandler (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
_Handler = lens
(\(ProcessHandler a b c d) -> (a,b,c,d))
(\_ (a,b,c,d) -> ProcessHandler a b c d)
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
}