HSH 2.0.4 → 2.1.3
raw patch · 3 files changed
Files
- HSH.cabal +3/−3
- HSH/Command.hs +33/−3
- HSH/ShellEquivs.hs +13/−5
HSH.cabal view
@@ -1,10 +1,10 @@ Name: HSH-Version: 2.0.4+Version: 2.1.3 License: LGPL Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen Stability: Beta-Copyright: Copyright (c) 2006-2009 John Goerzen+Copyright: Copyright (c) 2006-2017 John Goerzen Category: system license-file: COPYRIGHT extra-source-files: COPYING@@ -32,7 +32,7 @@ bytestring if !os(windows) Build-Depends: unix- GHC-Options: -O2 -threaded -Wall+ GHC-Options: -O2 -Wall Executable runtests if flag(buildtests)
HSH/Command.hs view
@@ -39,11 +39,11 @@ import System.IO import System.Exit import System.Log.Logger-import System.IO.Error hiding (catch)+import System.IO.Error (isUserError, ioeGetErrorString) import Data.Maybe.Utils import Data.Maybe import Data.List.Utils(uniq)-import Control.Exception(evaluate, SomeException, catch)+import Control.Exception(try, evaluate, SomeException, catch) import Text.Regex.Posix import Control.Monad(when) import Data.String.Utils(rstrip)@@ -298,6 +298,21 @@ -- Added field in process 1.1.0.0: , create_group = False #endif+#if MIN_VERSION_process(1,2,0)+ , delegate_ctlc = False+#endif+#if MIN_VERSION_process(1,3,0)+ , detach_console = False+ , create_new_console = False+ , new_session = False+#endif+#if MIN_VERSION_process(1,4,0)+ , child_group = Nothing+ , child_user = Nothing+#endif+#if MIN_VERSION_process(1,5,0)+ , use_process_jobs = False+#endif } in do (_, oh', _, ph) <- createProcess cp let oh = fromJust oh'@@ -314,6 +329,21 @@ -- Added field in process 1.1.0.0: , create_group = False #endif+#if MIN_VERSION_process(1,2,0)+ , delegate_ctlc = False+#endif+#if MIN_VERSION_process(1,3,0)+ , detach_console = False+ , create_new_console = False+ , new_session = False+#endif+#if MIN_VERSION_process(1,4,0)+ , child_group = Nothing+ , child_user = Nothing+#endif+#if MIN_VERSION_process(1,5,0)+ , use_process_jobs = False+#endif } in do (ih', oh', _, ph) <- createProcess cp let ih = fromJust ih'@@ -494,7 +524,7 @@ {- | Handle an exception derived from a program exiting abnormally -} tryEC :: IO a -> IO (Either ExitCode a) tryEC action =- do r <- try action+ do r <- Control.Exception.try action case r of Left ioe -> if isUserError ioe then
HSH/ShellEquivs.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} {- Shell Equivalents Copyright (C) 2004-2009 John Goerzen <jgoerzen@complete.org> Please see the COPYRIGHT file@@ -20,6 +21,8 @@ -} +{-# LANGUAGE ScopedTypeVariables #-}+ #if !(defined(mingw32_HOST_OS) || defined(mingw32_TARGET_OS) || defined(__MINGW32__)) #define __HSH_POSIX__ #else@@ -83,8 +86,8 @@ import Text.Regex (matchRegex, mkRegex) import Text.Printf (printf) import Control.Monad (foldM)-import System.Directory hiding (createDirectory)-import Control.Exception(evaluate)+import System.Directory hiding (createDirectory, isSymbolicLink)+import qualified Control.Exception as E -- import System.FilePath (splitPath) #ifdef __HSH_POSIX__@@ -109,7 +112,12 @@ import HSH.Command(setenv, unsetenv) {- | Return the absolute path of the arg. Raises an error if the-computation is impossible. -}+computation is impossible. This is a thin wrapper around+System.Path.absNormPath. Unix/Linux users note:+System.Path.absNormPath is known to produce odd results when+a tilde expansion is requested; you might prefer 'glob' to this+function if you know your input is free of wildcards. See+https://github.com/jgoerzen/hsh/issues/7 for details. -} abspath :: FilePath -> IO FilePath abspath inp = do p <- pwd@@ -250,7 +258,7 @@ discard :: Channel -> IO Channel discard inh = do c <- chanAsBSL inh- evaluate (BSL.length c)+ E.evaluate (BSL.length c) return (ChanString "") {- | Split a list by a given character and select ranges of the resultant lists.@@ -314,7 +322,7 @@ Non-tilde expansion is done by the MissingH module System.Path.Glob. -} glob :: FilePath -> IO [FilePath] glob inp@('~':remainder) =- catch expanduser (\_ -> Glob.glob rest)+ E.catch expanduser (\(e::E.SomeException) -> Glob.glob rest) where (username, rest) = span (/= '/') remainder #ifdef __HSH_POSIX__ expanduser =