Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module GHCup.Utils.File.Common
- executeOut :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> m CapturedProcess
- execLogged :: (MonadReader env m, HasSettings env, HasLog env, HasDirs env, MonadIO m, MonadThrow m) => FilePath -> [String] -> Maybe FilePath -> FilePath -> Maybe [(String, String)] -> m (Either ProcessError ())
- captureOutStreams :: IO a -> IO CapturedProcess
- actionWithPipes :: ((Fd, Fd) -> IO b) -> IO b
- cleanup :: [Fd] -> IO ()
- createRegularFileFd :: FileMode -> FilePath -> IO Fd
- exec :: MonadIO m => String -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> m (Either ProcessError ())
- toProcessError :: FilePath -> [String] -> Maybe ProcessStatus -> Either ProcessError ()
- chmod_755 :: (MonadReader env m, HasLog env, MonadIO m) => FilePath -> m ()
- newFilePerms :: FileMode
- isBrokenSymlink :: FilePath -> IO Bool
Documentation
module GHCup.Utils.File.Common
:: MonadIO m | |
=> FilePath | command as filename, e.g. |
-> [String] | arguments to the command |
-> Maybe FilePath | chdir to this path |
-> m CapturedProcess |
Execute the given command and collect the stdout, stderr and the exit code. The command is run in a subprocess.
:: (MonadReader env m, HasSettings env, HasLog env, HasDirs env, MonadIO m, MonadThrow m) | |
=> FilePath | thing to execute |
-> [String] | args for the thing |
-> Maybe FilePath | optionally chdir into this |
-> FilePath | log filename (opened in append mode) |
-> Maybe [(String, String)] | optional environment |
-> m (Either ProcessError ()) |
:: IO a | the action to execute in a subprocess |
-> IO CapturedProcess |
Capture the stdout and stderr of the given action, which
is run in a subprocess. Stdin is closed. You might want to
race
this to make sure it terminates.
createRegularFileFd :: FileMode -> FilePath -> IO Fd Source #
Create a new regular file in write-only mode. The file must not exist.
:: MonadIO m | |
=> String | thing to execute |
-> [String] | args for the thing |
-> Maybe FilePath | optionally chdir into this |
-> Maybe [(String, String)] | optional environment |
-> m (Either ProcessError ()) |
Thin wrapper around executeFile
.
toProcessError :: FilePath -> [String] -> Maybe ProcessStatus -> Either ProcessError () Source #
newFilePerms :: FileMode Source #
Default permissions for a new file.