simple-cmd 0.1.3 → 0.1.3.1
raw patch · 5 files changed
+27/−4 lines, 5 filesdep +unixPVP ok
version bump matches the API change (PVP)
Dependencies added: unix
API changes (from Hackage documentation)
Files
- ChangeLog.md +3/−0
- SimpleCmd.hs +14/−2
- SimpleCmd/Git.hs +4/−0
- SimpleCmd/Rpm.hs +4/−0
- simple-cmd.cabal +2/−2
ChangeLog.md view
@@ -1,5 +1,8 @@ # Revision history for simple-cmd +## 0.1.3.1+- sudo: ignored for root or when no sudo installed+ ## 0.1.3 -- 2019-02-20 - gitDiffQuiet - fix rwGitDir regexp
SimpleCmd.hs view
@@ -49,11 +49,15 @@ #else import Control.Applicative ((<$>)) #endif+import Control.Monad (when) import Data.List (stripPrefix)-import Data.Maybe (fromMaybe)+import Data.Maybe (isNothing, fromMaybe) +import System.Directory (findExecutable) import System.Exit (ExitCode (..))+import System.IO (hPutStrLn, stderr)+import System.Posix.User (getEffectiveUserID) import System.Process (readProcess, readProcessWithExitCode, rawSystem) removeTrailingNewline :: String -> String@@ -196,7 +200,15 @@ sudo :: String -- ^ command -> [String] -- ^ arguments -> IO ()-sudo c args = cmdlog "sudo" (c:args)+sudo c args = do+ uid <- getEffectiveUserID+ sd <- if uid == 0+ then return Nothing+ else findExecutable "sudo"+ let noSudo = isNothing sd+ when (uid /= 0 && noSudo) $+ hPutStrLn stderr "'sudo' not found"+ cmdlog (fromMaybe c sd) (if noSudo then args else c:args) -- | Combine two strings with a single space infixr 4 +-+
SimpleCmd/Git.hs view
@@ -1,3 +1,7 @@+{-|+Some wrappers for git commands.+-}+ module SimpleCmd.Git ( git, git_,
SimpleCmd/Rpm.hs view
@@ -1,3 +1,7 @@+{-|+This Rpm module currently only provides @rpmspec@.+-}+ module SimpleCmd.Rpm ( rpmspec ) where
simple-cmd.cabal view
@@ -1,5 +1,5 @@ name: simple-cmd-version: 0.1.3+version: 0.1.3.1 synopsis: Simple String-based process commands description: Thin wrappers over System.Process (readProcess,@@ -28,7 +28,7 @@ exposed-modules: SimpleCmd, SimpleCmd.Git, SimpleCmd.Rpm- build-depends: base < 5, directory, filepath, process+ build-depends: base < 5, directory, filepath, process, unix default-language: Haskell2010 default-extensions: CPP ghc-options: -fwarn-missing-signatures -Wall