packages feed

handsy 0.0.5 → 0.0.6

raw patch · 2 files changed

+17/−1 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ System.Handsy: command_ :: FilePath -> [String] -> ByteString -> Handsy (ByteString, ByteString)
+ System.Handsy: shell_ :: String -> ByteString -> Handsy (ByteString, ByteString)

Files

handsy.cabal view
@@ -1,5 +1,5 @@ name:          handsy-version:       0.0.5+version:       0.0.6 synopsis:      A DSL to describe common shell operations and interpeters for running them locally and remotely. -- description:    Homepage:      https://github.com/utdemir/handsy
src/System/Handsy.hs view
@@ -1,9 +1,11 @@+{-# LANGUAGE LambdaCase        #-} {-# LANGUAGE OverloadedStrings #-}  module System.Handsy where  import           Control.Monad.IO.Class import qualified Data.ByteString.Lazy           as B+import qualified Data.ByteString.Lazy.Char8     as C import           System.Exit  import           Control.Monad.Free.TH@@ -46,6 +48,20 @@       -> B.ByteString -- ^ Standart input       -> Handsy (ExitCode, B.ByteString, B.ByteString) -- ^ (ExitCode, Stdout, Stderr) shell cmd stdin = command "/usr/bin/env" ["sh", "-c", cmd] stdin++-- | Same as 'shell', but ExitFailure is a runtime error.+shell_ :: String  -> B.ByteString -> Handsy (B.ByteString, B.ByteString)+shell_ cmd stdin = shell cmd stdin >>= \case+  (ExitFailure code, _, stderr) -> error ('`':cmd ++ "` returned " ++ show code+                                       ++ "\nStderr was: " ++ (C.unpack stderr))+  (ExitSuccess, stdout, stderr) -> return (stdout, stderr)++-- | Same as 'command', but ExitFailure is a runtime error.+command_ :: FilePath -> [String] -> B.ByteString -> Handsy (B.ByteString, B.ByteString)+command_ path args stdin = command path args stdin >>= \case+  (ExitFailure code, _, stderr) -> error ('`':path ++ ' ' :(show args) ++ "` returned " ++ show code+                                       ++ "\nStderr was: " ++ (C.unpack stderr))+  (ExitSuccess, stdout, stderr) -> return (stdout, stderr)  -- * Interpreter