From dd0e3495cc6bf05eee99ecd437ad67bf5f4842c0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 10 May 2014 10:46:36 -0300 Subject: merge from git-annex --- Utility/Directory.hs | 2 +- Utility/Exception.hs | 2 +- Utility/FileMode.hs | 1 + Utility/LinuxMkLibs.hs | 2 +- Utility/Process.hs | 4 ++++ Utility/ThreadScheduler.hs | 4 +++- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Utility/Directory.hs b/Utility/Directory.hs index f1bcfada..c2a50714 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 cf2c615c..6f3c059f 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 4302f8bd..9c15da8c 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 76e6266d..f4744fcb 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 1945e4b9..3f93dc2f 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 9d4cfd0a..dd88dc87 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__ -- cgit v1.2.3