diff --git a/Utility/Directory.hs b/Utility/Directory.hs index f1bcfad..c2a5071 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -43,7 +43,7 @@ dirContents d = map (d ) . filter (not . dirCruft) <$> getDirectoryContents d - When the directory does not exist, no exception is thrown, - instead, [] is returned. -} dirContentsRecursive :: FilePath -> IO [FilePath] -dirContentsRecursive topdir = dirContentsRecursiveSkipping (const False) True topdir +dirContentsRecursive = dirContentsRecursiveSkipping (const False) True {- Skips directories whose basenames match the skipdir. -} dirContentsRecursiveSkipping :: (FilePath -> Bool) -> Bool -> FilePath -> IO [FilePath] diff --git a/Utility/Exception.hs b/Utility/Exception.hs index cf2c615..6f3c059 100644 --- a/Utility/Exception.hs +++ b/Utility/Exception.hs @@ -18,7 +18,7 @@ import Utility.Data {- Catches IO errors and returns a Bool -} catchBoolIO :: IO Bool -> IO Bool -catchBoolIO a = catchDefaultIO False a +catchBoolIO = catchDefaultIO False {- Catches IO errors and returns a Maybe -} catchMaybeIO :: IO a -> IO (Maybe a) diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs index 4302f8b..9c15da8 100644 --- a/Utility/FileMode.hs +++ b/Utility/FileMode.hs @@ -13,6 +13,7 @@ import System.IO import Control.Monad import Control.Exception (bracket) import System.PosixCompat.Types +import Utility.PosixFiles #ifndef mingw32_HOST_OS import System.Posix.Files #endif diff --git a/Utility/LinuxMkLibs.hs b/Utility/LinuxMkLibs.hs index 76e6266..f4744fc 100644 --- a/Utility/LinuxMkLibs.hs +++ b/Utility/LinuxMkLibs.hs @@ -49,7 +49,7 @@ inTop top f = top ++ f - link to. Note that some of the libraries may not exist - (eg, linux-vdso.so) -} parseLdd :: String -> [FilePath] -parseLdd = catMaybes . map (getlib . dropWhile isSpace) . lines +parseLdd = mapMaybe (getlib . dropWhile isSpace) . lines where getlib l = headMaybe . words =<< lastMaybe (split " => " l) diff --git a/Utility/Process.hs b/Utility/Process.hs index 1945e4b..3f93dc2 100644 --- a/Utility/Process.hs +++ b/Utility/Process.hs @@ -31,6 +31,7 @@ module Utility.Process ( stdinHandle, stdoutHandle, stderrHandle, + processHandle, devNull, ) where @@ -313,6 +314,9 @@ bothHandles :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> (Han bothHandles (Just hin, Just hout, _, _) = (hin, hout) bothHandles _ = error "expected bothHandles" +processHandle :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> ProcessHandle +processHandle (_, _, _, pid) = pid + {- Debugging trace for a CreateProcess. -} debugProcess :: CreateProcess -> IO () debugProcess p = do diff --git a/Utility/ThreadScheduler.hs b/Utility/ThreadScheduler.hs index 9d4cfd0..dd88dc8 100644 --- a/Utility/ThreadScheduler.hs +++ b/Utility/ThreadScheduler.hs @@ -11,9 +11,11 @@ module Utility.ThreadScheduler where import Control.Monad +import Control.Concurrent +#ifndef mingw32_HOST_OS import Control.Monad.IfElse import System.Posix.IO -import Control.Concurrent +#endif #ifndef mingw32_HOST_OS import System.Posix.Signals #ifndef __ANDROID__