diff --git a/simple-cmd.cabal b/simple-cmd.cabal index 4cdad2b..038b99f 100644 --- a/simple-cmd.cabal +++ b/simple-cmd.cabal @@ -1,5 +1,5 @@ name: simple-cmd -version: 0.2.6 +version: 0.2.7 synopsis: Simple String-based process commands description: Simple wrappers over System.Process @@ -20,6 +20,7 @@ cabal-version: >=1.10 extra-source-files: README.md ChangeLog.md TODO tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2 + GHC == 9.2.2 source-repository head type: git @@ -35,8 +36,9 @@ library extra, filepath, process >= 1.4.3.0, - time, - unix + time + if !os(windows) + build-depends: unix default-language: Haskell2010 default-extensions: CPP ghc-options: -Wall diff --git a/src/SimpleCmd.hs b/src/SimpleCmd.hs index 6d62f15..27ff800 100644 --- a/src/SimpleCmd.hs +++ b/src/SimpleCmd.hs @@ -53,7 +53,9 @@ module SimpleCmd ( egrep_, grep, grep_, shell, shell_, shellBool, +#ifndef mingw32_HOST_OS sudo, sudo_, +#endif PipeCommand, pipe, pipe_, pipeBool, pipe3, pipe3_, pipeFile_, @@ -85,7 +87,9 @@ import System.Exit (ExitCode (..)) import System.FilePath import System.IO (hGetContents, hPutStr, hPutStrLn, IOMode(ReadMode), stderr, stdout, withFile, Handle) +#ifndef mingw32_HOST_OS import System.Posix.User (getEffectiveUserID) +#endif import System.Process (createProcess, CreateProcess (cmdspec), proc, ProcessHandle, rawSystem, readProcess, @@ -298,6 +302,7 @@ egrep_ :: String -> FilePath -> IO Bool egrep_ pat file = cmdBool "grep" ["-q", "-e", pat, file] +#ifndef mingw32_HOST_OS -- | @sudo c args@ runs a command as sudo returning stdout -- -- Result type changed from IO () to IO String in 0.2.0 @@ -324,6 +329,7 @@ sudoInternal exc c args = do when (uid /= 0 && noSudo) $ warning "'sudo' not found" exc (fromMaybe c sd) (if noSudo then args else c:args) +#endif -- | Combine two strings with a single space infixr 4 +-+