Unixutils-1.45: A crude interface between Haskell and Unix-like operating systems

System.Unix.Progress

Contents

Description

Support for changing the output of a lazyCommand in several ways:

  • Output a dot for every 128 characters of the original output
  • Increase the quietness level before running the command
  • Output only if (and when) the command fails
  • Throw an exception if the command fails
  • No output

Synopsis

The Progress Monad

data ProgressFlag Source

The flags that control what type of output will be sent to stdout and stderr. Also, the ExceptionOnFail flag controls whether an exception will be thrown if the ExitCode is not ExitSuccess.

Constructors

Echo 
Dots 
All 
Errors 
Result 
EchoOnFail

If Echo is present this has no effect

AllOnFail

If All is present this has no effect

ErrorsOnFail 
ResultOnFail 
ExceptionOnFail 

Process launching

lazyCommandP :: MonadIO m => String -> ByteString -> Set ProgressFlag -> m [Output]Source

The P versions are the most general cases, here you can specify a function that turns the quietness level into any set of progress flags you like.

timeTask :: MonadIO m => m a -> m (a, NominalDiffTime)Source

Run a task and return the elapsed time along with its result.

showElapsed :: MonadIO m => String -> m a -> m aSource

Perform a task, print the elapsed time it took, and return the result.

Unit tests

tests :: [Test]Source

Unit tests.

A set of lazyCommand functions for an example set of verbosity levels