| Copyright | (c) 2015 Javran Cheng |
|---|---|
| License | MIT |
| Maintainer | Javran.C@gmail.com |
| Stability | unstable |
| Portability | non-portable (requires X11) |
| Safe Haskell | None |
| Language | Haskell2010 |
XMonad.Util.EntryHelper.Compile
Description
Compiling-related functions
- defaultCompile :: Bool -> IO ExitCode
- defaultPostCompile :: ExitCode -> IO ()
- compileUsingShell :: String -> IO ExitCode
- withFileLock :: FilePath -> a -> IO a -> IO a
- withLock :: a -> IO a -> IO a
Documentation
defaultCompile :: Bool -> IO ExitCode Source
the default compiling action.
checks whether any of the sources files under "~/.xmonad/"
is newer than the binary and recompiles XMonad if so.
defaultPostCompile :: ExitCode -> IO () Source
the default post-compiling action. prints out error log to stderr and pops up a message when the last compilation has failed.
compileUsingShell :: String -> IO ExitCode Source
compileUsingShell cmd spawns a new process to run a shell command
(shell expansion is applied).
The working directory of the shell command is "~/.xmonad/", and
the process' stdout and stdout are redirected to "~/.xmonad/xmonad.errors"
withFileLock :: FilePath -> a -> IO a -> IO a Source
prevents an IO action from parallel execution by using a lock file.
withFileLock fpath def action checks whether the file indicated by fpath
exists. And:
- returns
defif the file exists. - creates
fpath, executes the action, and deletesfpathwhen the action has completed. Ifactionhas failed,defwill be returned instead.
Note that:
- the action will be protected by
safeIO, meaning the lock file will be deleted regardless of any error. - No check on
fpathwill be done by this function. Please make sure the lock file does not exist. - please prevent wrapping the action with same file lock multiple times, in which case the action will never be executed.
withLock :: a -> IO a -> IO a Source
withLock def action is the same as withFileLock fpath def action with
fpath being "xmonad.${USERNAME}.lock" under your temporary directory.
Wrapping an action with more than one withLock will not work.
See also: withFileLock, getTemporaryDirectory, getEffectiveUserName