Safe Haskell | None |
---|---|
Language | Haskell98 |
Re-exports some of propellor's internal utility modules.
These are used in the implementation of propellor, including some of its properties. However, there is no API stability; any of these can change or be removed without a major version number increase.
Use outside propellor at your own risk.
- read :: Read a => String -> a
- head :: [a] -> a
- tail :: [a] -> [a]
- init :: [a] -> [a]
- last :: [a] -> a
- readish :: Read a => String -> Maybe a
- headMaybe :: [a] -> Maybe a
- lastMaybe :: [a] -> Maybe a
- beginning :: [a] -> [a]
- end :: [a] -> [a]
- data CreateProcess :: * = CreateProcess {
- cmdspec :: CmdSpec
- cwd :: Maybe FilePath
- env :: Maybe [(String, String)]
- std_in :: StdStream
- std_out :: StdStream
- std_err :: StdStream
- close_fds :: Bool
- create_group :: Bool
- delegate_ctlc :: Bool
- detach_console :: Bool
- create_new_console :: Bool
- new_session :: Bool
- child_group :: Maybe GroupID
- child_user :: Maybe UserID
- data StdHandle
- readProcess :: FilePath -> [String] -> IO String
- readProcess' :: CreateProcess -> IO String
- readProcessEnv :: FilePath -> [String] -> Maybe [(String, String)] -> IO String
- writeReadProcessEnv :: FilePath -> [String] -> Maybe [(String, String)] -> Maybe (Handle -> IO ()) -> Maybe (Handle -> IO ()) -> IO String
- forceSuccessProcess :: CreateProcess -> ProcessHandle -> IO ()
- forceSuccessProcess' :: CreateProcess -> ExitCode -> IO ()
- checkSuccessProcess :: ProcessHandle -> IO Bool
- ignoreFailureProcess :: ProcessHandle -> IO Bool
- createProcessSuccess :: CreateProcessRunner
- createProcessChecked :: (ProcessHandle -> IO b) -> CreateProcessRunner
- createBackgroundProcess :: CreateProcessRunner
- processTranscript :: String -> [String] -> Maybe String -> IO (String, Bool)
- processTranscript' :: (CreateProcess -> CreateProcess) -> String -> [String] -> Maybe String -> IO (String, Bool)
- withHandle :: StdHandle -> CreateProcessRunner -> CreateProcess -> (Handle -> IO a) -> IO a
- withIOHandles :: CreateProcessRunner -> CreateProcess -> ((Handle, Handle) -> IO a) -> IO a
- withOEHandles :: CreateProcessRunner -> CreateProcess -> ((Handle, Handle) -> IO a) -> IO a
- withQuietOutput :: CreateProcessRunner -> CreateProcess -> IO ()
- feedWithQuietOutput :: CreateProcessRunner -> CreateProcess -> (Handle -> IO a) -> IO a
- createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- waitForProcess :: ProcessHandle -> IO ExitCode
- startInteractiveProcess :: FilePath -> [String] -> Maybe [(String, String)] -> IO (ProcessHandle, Handle, Handle)
- stdinHandle :: HandleExtractor
- stdoutHandle :: HandleExtractor
- stderrHandle :: HandleExtractor
- ioHandles :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> (Handle, Handle)
- processHandle :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> ProcessHandle
- devNull :: FilePath
- catchBoolIO :: MonadCatch m => m Bool -> m Bool
- catchMaybeIO :: MonadCatch m => m a -> m (Maybe a)
- catchDefaultIO :: MonadCatch m => a -> m a -> m a
- catchMsgIO :: MonadCatch m => m a -> m (Either String a)
- catchIO :: MonadCatch m => m a -> (IOException -> m a) -> m a
- tryIO :: MonadCatch m => m a -> m (Either IOException a)
- bracketIO :: (MonadMask m, MonadIO m) => IO v -> (v -> IO b) -> (v -> m a) -> m a
- catchNonAsync :: MonadCatch m => m a -> (SomeException -> m a) -> m a
- tryNonAsync :: MonadCatch m => m a -> m (Either SomeException a)
- tryWhenExists :: MonadCatch m => m a -> m (Maybe a)
- catchIOErrorType :: MonadCatch m => IOErrorType -> (IOException -> m a) -> m a -> m a
- data IOErrorType :: *
- catchPermissionDenied :: MonadCatch m => (IOException -> m a) -> m a -> m a
- getEnv :: String -> IO (Maybe String)
- getEnvDefault :: String -> String -> IO String
- getEnvironment :: IO [(String, String)]
- setEnv :: String -> String -> Bool -> IO ()
- unsetEnv :: String -> IO ()
- addEntry :: Eq k => k -> v -> [(k, v)] -> [(k, v)]
- addEntries :: Eq k => [(k, v)] -> [(k, v)] -> [(k, v)]
- delEntry :: Eq k => k -> [(k, v)] -> [(k, v)]
- dirCruft :: FilePath -> Bool
- dirContents :: FilePath -> IO [FilePath]
- dirContentsRecursive :: FilePath -> IO [FilePath]
- dirContentsRecursiveSkipping :: (FilePath -> Bool) -> Bool -> FilePath -> IO [FilePath]
- dirTreeRecursiveSkipping :: (FilePath -> Bool) -> FilePath -> IO [FilePath]
- moveFile :: FilePath -> FilePath -> IO ()
- nukeFile :: FilePath -> IO ()
- data DirectoryHandle = DirectoryHandle IsOpen DirStream
- type IsOpen = MVar ()
- openDirectory :: FilePath -> IO DirectoryHandle
- closeDirectory :: DirectoryHandle -> IO ()
- readDirectory :: DirectoryHandle -> IO (Maybe FilePath)
- isDirectoryEmpty :: FilePath -> IO Bool
- module System.Directory
- type Template = String
- viaTmp :: (MonadMask m, MonadIO m) => (FilePath -> String -> m ()) -> FilePath -> String -> m ()
- withTmpFile :: (MonadIO m, MonadMask m) => Template -> (FilePath -> Handle -> m a) -> m a
- withTmpFileIn :: (MonadIO m, MonadMask m) => FilePath -> Template -> (FilePath -> Handle -> m a) -> m a
- withTmpDir :: (MonadMask m, MonadIO m) => Template -> (FilePath -> m a) -> m a
- withTmpDirIn :: (MonadMask m, MonadIO m) => FilePath -> Template -> (FilePath -> m a) -> m a
- removeTmpDir :: MonadIO m => FilePath -> m ()
- relatedTemplate :: FilePath -> FilePath
- firstM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)
- getM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
- anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool
- allM :: Monad m => (a -> m Bool) -> [a] -> m Bool
- untilTrue :: Monad m => [a] -> (a -> m Bool) -> m Bool
- ifM :: Monad m => m Bool -> (m a, m a) -> m a
- (<||>) :: Monad m => m Bool -> m Bool -> m Bool
- (<&&>) :: Monad m => m Bool -> m Bool -> m Bool
- observe :: Monad m => (a -> m b) -> m a -> m a
- after :: Monad m => m b -> m a -> m a
- noop :: Monad m => m ()
- hGetContentsStrict :: Handle -> IO String
- readFileStrict :: FilePath -> IO String
- readFileStrictAnyEncoding :: FilePath -> IO String
- writeFileAnyEncoding :: FilePath -> String -> IO ()
- separate :: (a -> Bool) -> [a] -> ([a], [a])
- firstLine :: String -> String
- segment :: (a -> Bool) -> [a] -> [[a]]
- prop_segment_regressionTest :: Bool
- segmentDelim :: (a -> Bool) -> [a] -> [[a]]
- massReplace :: [(String, String)] -> String -> String
- hGetSomeString :: Handle -> Int -> IO String
- reapZombies :: IO ()
- exitBool :: Bool -> IO a
Documentation
data CreateProcess :: * #
CreateProcess | |
|
readProcess :: FilePath -> [String] -> IO String Source #
Normally, when reading from a process, it does not need to be fed any standard input.
readProcess' :: CreateProcess -> IO String Source #
writeReadProcessEnv :: FilePath -> [String] -> Maybe [(String, String)] -> Maybe (Handle -> IO ()) -> Maybe (Handle -> IO ()) -> IO String Source #
Runs an action to write to a process on its stdin, returns its output, and also allows specifying the environment.
forceSuccessProcess :: CreateProcess -> ProcessHandle -> IO () Source #
Waits for a ProcessHandle, and throws an IOError if the process did not exit successfully.
forceSuccessProcess' :: CreateProcess -> ExitCode -> IO () Source #
checkSuccessProcess :: ProcessHandle -> IO Bool Source #
Waits for a ProcessHandle and returns True if it exited successfully. Note that using this with createProcessChecked will throw away the Bool, and is only useful to ignore the exit code of a process, while still waiting for it. -}
createProcessSuccess :: CreateProcessRunner Source #
Runs createProcess, then an action on its handles, and then forceSuccessProcess.
createProcessChecked :: (ProcessHandle -> IO b) -> CreateProcessRunner Source #
Runs createProcess, then an action on its handles, and then a checker action on its exit code, which must wait for the process.
createBackgroundProcess :: CreateProcessRunner Source #
Leaves the process running, suitable for lazy streaming. Note: Zombies will result, and must be waited on.
processTranscript :: String -> [String] -> Maybe String -> IO (String, Bool) Source #
Runs a process, optionally feeding it some input, and returns a transcript combining its stdout and stderr, and whether it succeeded or failed.
processTranscript' :: (CreateProcess -> CreateProcess) -> String -> [String] -> Maybe String -> IO (String, Bool) Source #
withHandle :: StdHandle -> CreateProcessRunner -> CreateProcess -> (Handle -> IO a) -> IO a Source #
Runs a CreateProcessRunner, on a CreateProcess structure, that is adjusted to pipe only from/to a single StdHandle, and passes the resulting Handle to an action.
withIOHandles :: CreateProcessRunner -> CreateProcess -> ((Handle, Handle) -> IO a) -> IO a Source #
Like withHandle, but passes (stdin, stdout) handles to the action.
withOEHandles :: CreateProcessRunner -> CreateProcess -> ((Handle, Handle) -> IO a) -> IO a Source #
Like withHandle, but passes (stdout, stderr) handles to the action.
withQuietOutput :: CreateProcessRunner -> CreateProcess -> IO () Source #
Forces the CreateProcessRunner to run quietly; both stdout and stderr are discarded.
feedWithQuietOutput :: CreateProcessRunner -> CreateProcess -> (Handle -> IO a) -> IO a Source #
Stdout and stderr are discarded, while the process is fed stdin from the handle.
createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) Source #
Wrapper around createProcess
that does debug logging.
waitForProcess :: ProcessHandle -> IO ExitCode Source #
Wrapper around waitForProcess
that does debug logging.
startInteractiveProcess :: FilePath -> [String] -> Maybe [(String, String)] -> IO (ProcessHandle, Handle, Handle) Source #
Starts an interactive process. Unlike runInteractiveProcess in System.Process, stderr is inherited.
stdinHandle :: HandleExtractor Source #
stdoutHandle :: HandleExtractor Source #
stderrHandle :: HandleExtractor Source #
processHandle :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> ProcessHandle Source #
catchBoolIO :: MonadCatch m => m Bool -> m Bool Source #
catchMaybeIO :: MonadCatch m => m a -> m (Maybe a) Source #
catchDefaultIO :: MonadCatch m => a -> m a -> m a Source #
catchMsgIO :: MonadCatch m => m a -> m (Either String a) Source #
catchIO :: MonadCatch m => m a -> (IOException -> m a) -> m a Source #
tryIO :: MonadCatch m => m a -> m (Either IOException a) Source #
catchNonAsync :: MonadCatch m => m a -> (SomeException -> m a) -> m a Source #
tryNonAsync :: MonadCatch m => m a -> m (Either SomeException a) Source #
tryWhenExists :: MonadCatch m => m a -> m (Maybe a) Source #
catchIOErrorType :: MonadCatch m => IOErrorType -> (IOException -> m a) -> m a -> m a Source #
data IOErrorType :: * #
An abstract type that contains a value for each variant of IOError
.
catchPermissionDenied :: MonadCatch m => (IOException -> m a) -> m a -> m a Source #
addEntries :: Eq k => [(k, v)] -> [(k, v)] -> [(k, v)] Source #
closeDirectory :: DirectoryHandle -> IO () Source #
readDirectory :: DirectoryHandle -> IO (Maybe FilePath) Source #
Reads the next entry from the handle. Once the end of the directory is reached, returns Nothing and automatically closes the handle.
module System.Directory
viaTmp :: (MonadMask m, MonadIO m) => (FilePath -> String -> m ()) -> FilePath -> String -> m () Source #
withTmpFileIn :: (MonadIO m, MonadMask m) => FilePath -> Template -> (FilePath -> Handle -> m a) -> m a Source #
withTmpDirIn :: (MonadMask m, MonadIO m) => FilePath -> Template -> (FilePath -> m a) -> m a Source #
removeTmpDir :: MonadIO m => FilePath -> m () Source #
relatedTemplate :: FilePath -> FilePath Source #
segmentDelim :: (a -> Bool) -> [a] -> [[a]] Source #
reapZombies :: IO () Source #