| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Stack.Prelude
- withSourceFile :: MonadUnliftIO m => FilePath -> (ConduitM i ByteString m () -> m a) -> m a
- withSinkFile :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a
- withSinkFileCautious :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a
- withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a
- withKeepSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a
- sinkProcessStderrStdout :: forall e o env. (HasProcessContext env, HasLogFunc env) => String -> [String] -> ConduitM ByteString Void (RIO env) e -> ConduitM ByteString Void (RIO env) o -> RIO env (e, o)
- sinkProcessStdout :: (HasProcessContext env, HasLogFunc env) => String -> [String] -> ConduitM ByteString Void (RIO env) a -> RIO env a
- logProcessStderrStdout :: (HasCallStack, HasProcessContext env, HasLogFunc env) => ProcessConfig stdin stdoutIgnored stderrIgnored -> RIO env ()
- readProcessNull :: (HasProcessContext env, HasLogFunc env) => String -> [String] -> RIO env ()
- withProcessContext :: HasProcessContext env => ProcessContext -> RIO env a -> RIO env a
- stripCR :: Text -> Text
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.
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 #
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.