add boolSystemEnv
This commit is contained in:
parent
56eaf4470a
commit
b5072b7b4c
1 changed files with 6 additions and 2 deletions
|
@ -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. -}
|
||||||
|
|
Loading…
Reference in a new issue