packages feed

shellmate 0.1.3 → 0.1.4

raw patch · 2 files changed

+33/−3 lines, 2 files

Files

Control/Shell.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE TypeSynonymInstances, FlexibleInstances, DeriveDataTypeable,              MultiParamTypeClasses, FunctionalDependencies,+             CPP,              UndecidableInstances #-} -- | Simple interface for shell scripting-like tasks. module Control.Shell ( @@ -13,8 +14,10 @@     withHomeDirectory, inHomeDirectory, withAppDirectory, inAppDirectory,     forEachFile, cpFiltered,     isFile, rm, mv, cp, file,-    withTempFile, withTempDirectory, inTempDirectory,+    withTempFile, withCustomTempFile,+    withTempDirectory, withCustomTempDirectory, inTempDirectory,     hPutStr, hPutStrLn, echo,+    (|>),     module System.FilePath, liftIO   ) where import Control.Applicative@@ -201,6 +204,9 @@         Proc.std_out      = Proc.CreatePipe,         Proc.std_err      = Proc.CreatePipe,         Proc.close_fds    = False,+#if MIN_VERSION_process(1,2,0)+        Proc.delegate_ctlc = False,+#endif         Proc.create_group = False       } @@ -241,6 +247,9 @@         Proc.std_out      = stdout,         Proc.std_err      = Proc.Inherit,         Proc.close_fds    = False,+#if MIN_VERSION_process(1,2,0)+        Proc.delegate_ctlc = False,+#endif         Proc.create_group = False       } @@ -384,6 +393,14 @@   where     act' env fp = Ex.catch (unSh (act fp) env) exHandler +-- | Create a temp directory in given directory, do something with it, then+--   remove it.+withCustomTempDirectory :: FilePath -> (FilePath -> Shell a) -> Shell a+withCustomTempDirectory dir act = Shell $ \env -> do+    Temp.withTempDirectory dir "shellmate" (act' env)+  where+    act' env fp = Ex.catch (unSh (act fp) env) exHandler+ -- | Performs a command inside a temporary directory. The directory will be --   cleaned up after the command finishes. inTempDirectory :: Shell a -> Shell a@@ -394,6 +411,14 @@ withTempFile :: String -> (FilePath -> IO.Handle -> Shell a) -> Shell a withTempFile template act = Shell $ \env -> do     Temp.withSystemTempFile template (act' env)+  where+    act' env fp h = Ex.catch (unSh (act fp h) env) exHandler++-- | Create a temp file in the standard system temp directory, do something+--   with it, then remove it.+withCustomTempFile :: FilePath -> (FilePath -> IO.Handle -> Shell a) -> Shell a+withCustomTempFile dir act = Shell $ \env -> do+    Temp.withTempFile dir "shellmate" (act' env)   where     act' env fp h = Ex.catch (unSh (act fp h) env) exHandler 
shellmate.cabal view
@@ -1,7 +1,7 @@ name:                shellmate-version:             0.1.3+version:             0.1.4 synopsis:            Simple interface for shell scripting in Haskell.--- description:         +description:         Aims to simplify development of cross-platform shell scripts and similar things. homepage:            http://github.com/valderman/shellmate license:             BSD3 license-file:        LICENSE@@ -11,6 +11,11 @@ category:            System build-type:          Simple cabal-version:       >=1.8+bug-reports:         http://github.com/valderman/shellmate/issues++source-repository head+    type:       git+    location:   https://github.com/valderman/shellmate.git  library   exposed-modules: