diff options
Diffstat (limited to 'Utility/SafeCommand.hs')
-rw-r--r-- | Utility/SafeCommand.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Utility/SafeCommand.hs b/Utility/SafeCommand.hs index e6075e888..785aec578 100644 --- a/Utility/SafeCommand.hs +++ b/Utility/SafeCommand.hs @@ -55,8 +55,16 @@ safeSystemEnv command params environ = do { env = environ } waitForProcess pid +{- Wraps a shell command line inside sh -c, allowing it to be run in a + - login shell that may not support POSIX shell, eg csh. -} +shellWrap :: String -> String +shellWrap cmdline = "sh -c " ++ shellEscape cmdline + {- Escapes a filename or other parameter to be safely able to be exposed to - - the shell. -} + - the shell. + - + - This method works for POSIX shells, as well as other shells like csh. + -} shellEscape :: String -> String shellEscape f = "'" ++ escaped ++ "'" where |