stack-1.7.1: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Prelude

Synopsis

Documentation

withSourceFile :: MonadUnliftIO m => FilePath -> (ConduitM i ByteString m () -> m a) -> m a Source #

Get a source for a file. Unlike sourceFile, doesn't require ResourceT. Unlike explicit withBinaryFile and sourceHandle usage, you can't accidentally use WriteMode instead of ReadMode.

withSinkFile :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a Source #

Same idea as withSourceFile, see comments there.

withSinkFileCautious :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a Source #

Like withSinkFile, but ensures that the file is atomically moved after all contents are written.

withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a Source #

Path version

withKeepSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a Source #

Like withSystemTempDir, but the temporary directory is not deleted.

sinkProcessStderrStdout Source #

Arguments

:: (HasProcessContext env, HasLogFunc env) 
=> String

Command

-> [String]

Command line arguments

-> ConduitM ByteString Void (RIO env) e

Sink for stderr

-> ConduitM ByteString Void (RIO env) o

Sink for stdout

-> RIO env (e, o) 

Consume the stdout and stderr of a process feeding strict ByteStrings to the consumers.

Throws a ReadProcessException if unsuccessful in launching, or ProcessExitedUnsuccessfully if the process itself fails.

sinkProcessStdout Source #

Arguments

:: (HasProcessContext env, HasLogFunc env) 
=> String

Command

-> [String]

Command line arguments

-> ConduitM ByteString Void (RIO env) a

Sink for stdout

-> RIO env a 

Consume the stdout of a process feeding strict ByteStrings to a consumer. If the process fails, spits out stdout and stderr as error log level. Should not be used for long-running processes or ones with lots of output; for that use sinkProcessStderrStdout.

Throws a ReadProcessException if unsuccessful.

logProcessStderrStdout :: (HasCallStack, HasProcessContext env, HasLogFunc env) => ProcessConfig stdin stdoutIgnored stderrIgnored -> RIO env () Source #

readProcessNull Source #

Arguments

:: (HasProcessContext env, HasLogFunc env) 
=> String

Command

-> [String]

Command line arguments

-> RIO env () 

Read from the process, ignoring any output.

Throws a ReadProcessException exception if the process fails.

withProcessContext :: HasProcessContext env => ProcessContext -> RIO env a -> RIO env a Source #

Use the new ProcessContext, but retain the working directory from the parent environment.

stripCR :: Text -> Text Source #

Remove a trailing carriage return if present