summaryrefslogtreecommitdiff
path: root/Utility.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-31 16:00:32 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-31 16:00:32 -0400
commitcf4c926f2e78bd315988c1aae063f6b4148a2fae (patch)
treef7fdc76a1cc92c2c2836aff9ea10543679ab0457 /Utility.hs
parentb2c28c1ac0700eadc8689cdfb6f065d5147108bd (diff)
more Wall cleaning
Diffstat (limited to 'Utility.hs')
-rw-r--r--Utility.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/Utility.hs b/Utility.hs
index e7b4b510b..6867f473a 100644
--- a/Utility.hs
+++ b/Utility.hs
@@ -15,20 +15,17 @@ module Utility (
) where
import System.IO
-import System.Cmd.Utils
import System.Exit
import System.Posix.Process
-import System.Posix.Process.Internals
import System.Posix.Signals
-import System.Posix.IO
import Data.String.Utils
import System.Path
-import System.IO.HVFS
import System.FilePath
import System.Directory
{- A version of hgetContents that is not lazy. Ensures file is
- all read before it gets closed. -}
+hGetContentsStrict :: Handle -> IO String
hGetContentsStrict h = hGetContents h >>= \s -> length s `seq` return s
{- Returns the parent directory of a path. Parent of / is "" -}
@@ -53,11 +50,11 @@ parentDir dir =
relPathCwdToDir :: FilePath -> IO FilePath
relPathCwdToDir dir = do
cwd <- getCurrentDirectory
- let absdir = abs cwd dir
+ let absdir = absnorm cwd
return $ relPathDirToDir cwd absdir
where
-- absolute, normalized form of the directory
- abs cwd dir =
+ absnorm cwd =
case (absNormPath cwd dir) of
Just d -> d
Nothing -> error $ "unable to normalize " ++ dir
@@ -106,13 +103,14 @@ boolSystem command params = do
_ -> return False
where
restoresignals oldint oldset = do
- installHandler sigINT oldint Nothing
+ _ <- installHandler sigINT oldint Nothing
setSignalMask oldset
childaction oldint oldset = do
restoresignals oldint oldset
executeFile command True params Nothing
{- Escapes a filename to be safely able to be exposed to the shell. -}
+shellEscape :: FilePath -> FilePath
shellEscape f = "'" ++ quote ++ "'"
where
-- replace ' with '"'"'