Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
BuildEnv.Utils
Description
Various utilities:
- Spawning of processes in particular environments; see
callProcessInIO
. - Semaphores.
Synopsis
- data ProgPath from
- = AbsPath {
- absProgPath :: !(AbsolutePath File)
- | RelPath {
- relProgPath :: !(SymbolicPath from File)
- = AbsPath {
- data CallProcess dir = CP {
- cwd :: !(SymbolicPath CWD (Dir dir))
- extraPATH :: ![FilePath]
- extraEnvVars :: ![(String, String)]
- prog :: !(ProgPath dir)
- args :: !Args
- logBasePath :: !(Maybe (AbsolutePath File))
- sem :: !AbstractSem
- callProcessInIO :: HasCallStack => Maybe Counter -> CallProcess dir -> IO ()
- data TempDirPermanence
- withTempDir :: TempDirPermanence -> String -> (AbsolutePath (Dir Tmp) -> IO a) -> IO a
- newtype AbstractSem = AbstractSem {
- withAbstractSem :: forall r. IO r -> IO r
- withNewAbstractSem :: AsyncSem -> (AbstractSem -> Args -> IO r) -> IO r
- noSem :: AbstractSem
- abstractQSem :: QSem -> AbstractSem
- splitOn :: Char -> String -> [String]
Call a process in a given environment
The path of a program to run.
Constructors
AbsPath | An absolute path, or an executable in |
Fields
| |
RelPath | A relative path, relative to the |
Fields
|
data CallProcess dir Source #
Arguments to callProcess
.
Constructors
CP | |
Fields
|
Arguments
:: HasCallStack | |
=> Maybe Counter | Optional counter. Used when the command fails, to report the progress that has been made so far. |
-> CallProcess dir | |
-> IO () |
Run a command and wait for it to complete.
Crashes if the process returns with non-zero exit code.
See CallProcess
for a description of the options.
Create temporary directories
data TempDirPermanence Source #
How to handle deletion of temporary directories.
Constructors
DeleteTempDirs | |
Don'tDeleteTempDirs |
Instances
Show TempDirPermanence Source # | |
Defined in BuildEnv.Config Methods showsPrec :: Int -> TempDirPermanence -> ShowS # show :: TempDirPermanence -> String # showList :: [TempDirPermanence] -> ShowS # |
Arguments
:: TempDirPermanence | whether to delete the temporary directory after the action completes |
-> String | directory name template |
-> (AbsolutePath (Dir Tmp) -> IO a) | action to perform |
-> IO a |
Perform an action with a fresh temporary directory.
Abstract semaphores
newtype AbstractSem Source #
Abstract acquire/release mechanism.
Constructors
AbstractSem | |
Fields
|
Arguments
:: AsyncSem | |
-> (AbstractSem -> Args -> IO r) | the abstract semaphore to use, and extra
arguments to pass to |
-> IO r |
Create a semaphore-based acquire/release mechanism.
noSem :: AbstractSem Source #
No acquire/release mechanism required.
abstractQSem :: QSem -> AbstractSem Source #
Abstract acquire/release mechanism controlled by the given QSem
.