shellish 0.1.3 → 0.1.4
raw patch · 2 files changed
+9/−4 lines, 2 files
Files
- Shellish.hs +8/−3
- shellish.cabal +1/−1
Shellish.hs view
@@ -35,6 +35,7 @@ import Prelude hiding ( catch, readFile ) import Data.List( isInfixOf, (\\) )+import Data.Char( isAlphaNum ) import Data.Typeable import Data.IORef import Data.Maybe@@ -184,11 +185,14 @@ -- own. Use carefully. rm_rf :: FilePath -> ShIO () rm_rf f = path f >>= \f' -> do- let deletable = Permissions True True True True whenM (test_d f) $ do- find f' >>= mapM (\file -> liftIO $ setPermissions file deletable `catchany` \_ -> return ())+ find f' >>= mapM (\file -> liftIO $ fixPermissions file `catchany` \_ -> return ()) liftIO $ removeDirectoryRecursive f' whenM (test_f f) $ rm_f f'+ where fixPermissions file =+ do permissions <- liftIO $ getPermissions file+ let deletable = permissions { readable = True, writable = True, executable = True }+ liftIO $ setPermissions file deletable -- | Remove a file. Does not fail if the file already is not there. Does fail -- if the file is not a file.@@ -373,7 +377,8 @@ withTmpDir :: (FilePath -> ShIO a) -> ShIO a withTmpDir act = do dir <- liftIO $ getTemporaryDirectory- (path, handle) <- liftIO $ openTempFile dir "tmp"+ tid <- liftIO $ myThreadId+ (path, handle) <- liftIO $ openTempFile dir ("tmp"++filter isAlphaNum (show tid)) liftIO $ hClose handle -- required on windows rm_f path mkdir path
shellish.cabal view
@@ -3,7 +3,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.1.3+Version: 0.1.4 Synopsis: shell-/perl- like (systems) programming in Haskell