add boolSystemEnv

This commit is contained in:
Joey Hess 2011-04-28 16:08:18 -04:00
parent 56eaf4470a
commit b5072b7b4c

View file

@ -16,6 +16,7 @@ module Utility (
relPathCwdToFile, relPathCwdToFile,
relPathDirToFile, relPathDirToFile,
boolSystem, boolSystem,
boolSystemEnv,
shellEscape, shellEscape,
shellUnEscape, shellUnEscape,
unsetFileMode, unsetFileMode,
@ -73,7 +74,10 @@ toCommand l = concat $ map unwrap l
- SIGINT(ctrl-c) is allowed to propigate and will terminate the program. - SIGINT(ctrl-c) is allowed to propigate and will terminate the program.
-} -}
boolSystem :: FilePath -> [CommandParam] -> IO Bool boolSystem :: FilePath -> [CommandParam] -> IO Bool
boolSystem command params = do boolSystem command params = boolSystemEnv command params Nothing
boolSystemEnv :: FilePath -> [CommandParam] -> Maybe [(String, String)] -> IO Bool
boolSystemEnv command params env = do
-- Going low-level because all the high-level system functions -- Going low-level because all the high-level system functions
-- block SIGINT etc. We need to block SIGCHLD, but allow -- block SIGINT etc. We need to block SIGCHLD, but allow
-- SIGINT to do its default program termination. -- SIGINT to do its default program termination.
@ -93,7 +97,7 @@ boolSystem command params = do
setSignalMask oldset setSignalMask oldset
childaction oldint oldset = do childaction oldint oldset = do
restoresignals oldint oldset restoresignals oldint oldset
executeFile command True (toCommand params) Nothing executeFile command True (toCommand params) env
{- Escapes a filename or other parameter to be safely able to be exposed to {- Escapes a filename or other parameter to be safely able to be exposed to
- the shell. -} - the shell. -}