purebred-0.1.0.0: An mail user agent built around notmuch

Safe HaskellNone
LanguageHaskell2010

Purebred.System.Process

Contents

Synopsis

Documentation

tryReadProcessStderr :: (MonadError Error m, MonadIO m) => ProcessConfig stdoutIgnored stderr stdin -> m (ExitCode, Tainted ByteString) Source #

Try running a process given by the FilePath and catch an IOExceptions. This is to avoid a crashing process also take down the running Brick program.

Returns the exit code and the standard error output.

tryReadProcessStdout :: (MonadError Error m, MonadIO m) => ProcessConfig stdout stderrIgnored stdin -> m (ExitCode, Tainted ByteString) Source #

handleIOException :: AppState -> IOException -> IO AppState Source #

Handle only IOExceptions, everything else is fair game.

handleExitCodeThrow :: (MonadError Error m, MonadIO m) => (ExitCode, Tainted ByteString) -> a -> m Text Source #

Handler to handle exit failures and possibly showing an error in the UI.

handleExitCodeTempfileContents :: (MonadError Error m, MonadIO m) => (ExitCode, Tainted ByteString) -> FilePath -> m Text Source #

outputToText :: Tainted ByteString -> Text Source #

Convert tained output from a readProcess function to T.Text for display

readProcess :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, Tainted ByteString, Tainted ByteString) Source #

Run process, returning stdout and stderr as ByteString.

tmpfileResource :: (MonadIO m, MonadError Error m) => TempfileOnExit -> ResourceSpec m FilePath Source #

draftFileResoure Source #

Arguments

:: (MonadIO m, MonadError Error m) 
=> FilePath

maildir path

-> ResourceSpec m FilePath 

Uses a maildir filename template and stores the temporary file in the drafts folder.

emptyResource :: (MonadIO m, MonadError Error m) => ResourceSpec m () Source #

runEntityCommand :: (MonadMask m, MonadError Error m, MonadIO m) => EntityCommand m a -> m Text Source #

createDraftFilePath :: (MonadError Error m, MonadIO m) => FilePath -> m FilePath Source #

Create a temporary file in the drafts directory as a maildir compliant filepath used for editing mail bodies. Assumption: We don't cater for the case that the maildir does not exist! The maildir is the notmuch database directory. If the maildir wouldn't exist the entire application wouldn't run.

createSentFilePath :: (MonadError Error m, MonadIO m) => FilePath -> m FilePath Source #

Re-exports from System.Process.Typed

data ProcessConfig stdin stdout stderr #

Instances
Show (ProcessConfig stdin stdout stderr) 
Instance details

Defined in System.Process.Typed

Methods

showsPrec :: Int -> ProcessConfig stdin stdout stderr -> ShowS

show :: ProcessConfig stdin stdout stderr -> String

showList :: [ProcessConfig stdin stdout stderr] -> ShowS

(stdin ~ (), stdout ~ (), stderr ~ ()) => IsString (ProcessConfig stdin stdout stderr) 
Instance details

Defined in System.Process.Typed

Methods

fromString :: String -> ProcessConfig stdin stdout stderr

proc :: FilePath -> [String] -> ProcessConfig () () () #

shell :: String -> ProcessConfig () () () #

setStdin :: StreamSpec STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr #

byteStringInput :: ByteString -> StreamSpec STInput () #