-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Reflex FRP interface for running system processes -- -- Run and interact with system processes from within a Reflex FRP -- application. -- -- https://reflex-frp.org @package reflex-process @version 0.3.2.1 module Reflex.Process -- | Create a process feeding it input using an Event and exposing -- its output Events representing the process exit code, -- stdout, and stderr. -- -- The stdout and stderr Handles are -- line-buffered. -- -- N.B. The process input is buffered with an unbounded channel! For more -- control of this, use createProcessBufferingInput directly. -- -- N.B.: The std_in, std_out, and std_err parameters -- of the provided CreateProcess are replaced with new pipes and -- all output is redirected to those pipes. createProcess :: (MonadIO m, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m), MonadFix m) => CreateProcess -> ProcessConfig t (SendPipe ByteString) -> m (Process t ByteString ByteString) -- | Create a process feeding it input using an Event and exposing -- its output with Events for its exit code, stdout, and -- stderr. The input is fed via a buffer represented by a -- reading action and a writing action. -- -- The stdout and stderr Handles are -- line-buffered. -- -- For example, you may use Chan for an unbounded buffer (like -- createProcess does) like this: -- --
-- channel <- liftIO newChan -- createProcessBufferingInput (readChan channel) (writeChan channel) myConfig ---- -- Similarly you could use TChan. -- -- Bounded buffers may cause the Reflex network to block when you trigger -- an Event that would cause more data to be sent to a process -- whose stdin is blocked. -- -- If an unbounded channel would lead to too much memory usage you will -- want to consider * speeding up the consuming process. * buffering with -- the file system or another persistent storage to reduce memory usage. -- * if your usa case allows, dropping Events or messages that -- aren't important. -- -- N.B.: The std_in, std_out, and std_err parameters -- of the provided CreateProcess are replaced with new pipes and -- all output is redirected to those pipes. createProcessBufferingInput :: (MonadIO m, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m), MonadFix m) => IO (SendPipe ByteString) -> (SendPipe ByteString -> IO ()) -> CreateProcess -> ProcessConfig t (SendPipe ByteString) -> m (Process t ByteString ByteString) -- | A default ProcessConfig where stdin and signals are -- never sent. -- -- You can also use def. defProcessConfig :: Reflex t => ProcessConfig t i -- | Runs a process and uses the given input and output handler functions -- to interact with the process via the standard streams. Used to -- implement createProcess. -- -- N.B.: The std_in, std_out, and std_err parameters -- of the provided CreateProcess are replaced with new pipes and -- all output is redirected to those pipes. unsafeCreateProcessWithHandles :: forall t m i o e. (MonadIO m, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m)) => (Handle -> IO (i -> IO ())) -> (Handle -> (o -> IO ()) -> IO (IO ())) -> (Handle -> (e -> IO ()) -> IO (IO ())) -> CreateProcess -> ProcessConfig t i -> m (Process t o e) -- | The output of a process data Process t o e Process :: ProcessHandle -> Event t o -> Event t e -> Event t ExitCode -> Event t Signal -> Process t o e [_process_handle] :: Process t o e -> ProcessHandle -- | Fires whenever there's some new stdout output. Depending on the -- buffering strategy of the implementation, this could be anything from -- whole lines to individual characters. [_process_stdout] :: Process t o e -> Event t o -- | Fires whenever there's some new stderr output. See note on -- _process_stdout. [_process_stderr] :: Process t o e -> Event t e -- | Fires when the process is over and no stdout or -- stderr data is left. Once this fires, no other Events -- for the process will fire again. [_process_exit] :: Process t o e -> Event t ExitCode -- | Fires when a signal has actually been sent to the process (via -- _processConfig_signal). [_process_signal] :: Process t o e -> Event t Signal -- | The inputs to a process data ProcessConfig t i ProcessConfig :: Event t i -> Event t Signal -> ProcessConfig t i -- | stdin input to be fed to the process [_processConfig_stdin] :: ProcessConfig t i -> Event t i -- | Signals to send to the process [_processConfig_signal] :: ProcessConfig t i -> Event t Signal data SendPipe i -- | A message that's sent to the underlying process. This does NOT include -- a trailing newline when sending your message. SendPipe_Message :: i -> SendPipe i -- | Send an EOF to the underlying process. Once this is sent no further -- messages will be processed. SendPipe_EOF :: SendPipe i -- | Send the last message along with an EOF. Once this is sent no further -- messages will be processed. SendPipe_LastMessage :: i -> SendPipe i -- | Deprecated: Use unsafeCreateProcessWithHandles instead. createRedirectedProcess :: forall t m i o e. (MonadIO m, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m)) => (Handle -> IO (i -> IO ())) -> (Handle -> (o -> IO ()) -> IO (IO ())) -> (Handle -> (e -> IO ()) -> IO (IO ())) -> CreateProcess -> ProcessConfig t i -> m (Process t o e) instance GHC.Classes.Ord i => GHC.Classes.Ord (Reflex.Process.SendPipe i) instance GHC.Classes.Eq i => GHC.Classes.Eq (Reflex.Process.SendPipe i) instance GHC.Show.Show i => GHC.Show.Show (Reflex.Process.SendPipe i) instance Reflex.Class.Reflex t => Data.Default.Class.Default (Reflex.Process.ProcessConfig t i)