add shellEscape
ugly, but sometimes necessary There is a haskell shell-escape module, but it is not packaged in Debian
This commit is contained in:
parent
9ec5d90b6a
commit
91e6625eb5
1 changed files with 8 additions and 1 deletions
|
@ -7,7 +7,8 @@ module Utility (
|
||||||
parentDir,
|
parentDir,
|
||||||
relPathCwdToDir,
|
relPathCwdToDir,
|
||||||
relPathDirToDir,
|
relPathDirToDir,
|
||||||
boolSystem
|
boolSystem,
|
||||||
|
shellEscape
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import System.IO
|
import System.IO
|
||||||
|
@ -108,3 +109,9 @@ boolSystem command params = do
|
||||||
ExitFailure e -> if Just e == cast sigINT
|
ExitFailure e -> if Just e == cast sigINT
|
||||||
then error $ command ++ "interrupted"
|
then error $ command ++ "interrupted"
|
||||||
else return False
|
else return False
|
||||||
|
|
||||||
|
{- Escapes a filename to be safely able to be exposed to the shell. -}
|
||||||
|
shellEscape f = "'" ++ quote ++ "'"
|
||||||
|
where
|
||||||
|
-- replace ' with '"'"'
|
||||||
|
quote = join "'\"'\"'" $ split "'" f
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue