ghcup-0.1.17.10: ghc toolchain installer
Safe HaskellNone
LanguageHaskell2010

GHCup.Utils.File

Synopsis

Documentation

executeOut Source #

Arguments

:: MonadIO m 
=> FilePath

command as filename, e.g. ls

-> [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.

execLogged Source #

Arguments

:: (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 ()) 

captureOutStreams Source #

Arguments

:: 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.

actionWithPipes :: ((Fd, Fd) -> IO b) -> IO b Source #

cleanup :: [Fd] -> IO () Source #

createRegularFileFd :: FileMode -> FilePath -> IO Fd Source #

Create a new regular file in write-only mode. The file must not exist.

exec Source #

Arguments

:: 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.

chmod_755 :: (MonadReader env m, HasLog env, MonadIO m) => FilePath -> m () Source #

newFilePerms :: FileMode Source #

Default permissions for a new file.

isBrokenSymlink :: FilePath -> IO Bool Source #

Checks whether the binary is a broken link.