merge from git-annex

This commit is contained in:
Joey Hess 2014-05-10 10:46:36 -03:00
parent c2375ae087
commit dd0e3495cc
6 changed files with 11 additions and 4 deletions

View File

@ -43,7 +43,7 @@ dirContents d = map (d </>) . filter (not . dirCruft) <$> getDirectoryContents d
- When the directory does not exist, no exception is thrown, - When the directory does not exist, no exception is thrown,
- instead, [] is returned. -} - instead, [] is returned. -}
dirContentsRecursive :: FilePath -> IO [FilePath] dirContentsRecursive :: FilePath -> IO [FilePath]
dirContentsRecursive topdir = dirContentsRecursiveSkipping (const False) True topdir dirContentsRecursive = dirContentsRecursiveSkipping (const False) True
{- Skips directories whose basenames match the skipdir. -} {- Skips directories whose basenames match the skipdir. -}
dirContentsRecursiveSkipping :: (FilePath -> Bool) -> Bool -> FilePath -> IO [FilePath] dirContentsRecursiveSkipping :: (FilePath -> Bool) -> Bool -> FilePath -> IO [FilePath]

View File

@ -18,7 +18,7 @@ import Utility.Data
{- Catches IO errors and returns a Bool -} {- Catches IO errors and returns a Bool -}
catchBoolIO :: IO Bool -> IO Bool catchBoolIO :: IO Bool -> IO Bool
catchBoolIO a = catchDefaultIO False a catchBoolIO = catchDefaultIO False
{- Catches IO errors and returns a Maybe -} {- Catches IO errors and returns a Maybe -}
catchMaybeIO :: IO a -> IO (Maybe a) catchMaybeIO :: IO a -> IO (Maybe a)

View File

@ -13,6 +13,7 @@ import System.IO
import Control.Monad import Control.Monad
import Control.Exception (bracket) import Control.Exception (bracket)
import System.PosixCompat.Types import System.PosixCompat.Types
import Utility.PosixFiles
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import System.Posix.Files import System.Posix.Files
#endif #endif

View File

@ -49,7 +49,7 @@ inTop top f = top ++ f
- link to. Note that some of the libraries may not exist - link to. Note that some of the libraries may not exist
- (eg, linux-vdso.so) -} - (eg, linux-vdso.so) -}
parseLdd :: String -> [FilePath] parseLdd :: String -> [FilePath]
parseLdd = catMaybes . map (getlib . dropWhile isSpace) . lines parseLdd = mapMaybe (getlib . dropWhile isSpace) . lines
where where
getlib l = headMaybe . words =<< lastMaybe (split " => " l) getlib l = headMaybe . words =<< lastMaybe (split " => " l)

View File

@ -31,6 +31,7 @@ module Utility.Process (
stdinHandle, stdinHandle,
stdoutHandle, stdoutHandle,
stderrHandle, stderrHandle,
processHandle,
devNull, devNull,
) where ) where
@ -313,6 +314,9 @@ bothHandles :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> (Han
bothHandles (Just hin, Just hout, _, _) = (hin, hout) bothHandles (Just hin, Just hout, _, _) = (hin, hout)
bothHandles _ = error "expected bothHandles" bothHandles _ = error "expected bothHandles"
processHandle :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> ProcessHandle
processHandle (_, _, _, pid) = pid
{- Debugging trace for a CreateProcess. -} {- Debugging trace for a CreateProcess. -}
debugProcess :: CreateProcess -> IO () debugProcess :: CreateProcess -> IO ()
debugProcess p = do debugProcess p = do

View File

@ -11,9 +11,11 @@
module Utility.ThreadScheduler where module Utility.ThreadScheduler where
import Control.Monad import Control.Monad
import Control.Concurrent
#ifndef mingw32_HOST_OS
import Control.Monad.IfElse import Control.Monad.IfElse
import System.Posix.IO import System.Posix.IO
import Control.Concurrent #endif
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import System.Posix.Signals import System.Posix.Signals
#ifndef __ANDROID__ #ifndef __ANDROID__