{-# LANGUAGE CPP, FlexibleContexts, MultiParamTypeClasses #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module System.Process.Text where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
#endif
import Control.Monad
import Data.ListLike.IO (hGetContents)
import Data.Text (Text)
import Prelude hiding (null)
import System.Process
import System.Process.Common
import System.Exit (ExitCode)
instance ProcessText Text Char
instance ListLikeProcessIO Text Char where
forceOutput :: Text -> IO Text
forceOutput = Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return
readChunks :: Handle -> IO [Text]
readChunks Handle
h = (Text -> [Text] -> [Text]
forall a. a -> [a] -> [a]
: []) (Text -> [Text]) -> IO Text -> IO [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Handle -> IO Text
forall full item. ListLikeIO full item => Handle -> IO full
hGetContents Handle
h
readProcessWithExitCode
:: FilePath
-> [String]
-> Text
-> IO (ExitCode, Text, Text)
readProcessWithExitCode :: FilePath -> [FilePath] -> Text -> IO (ExitCode, Text, Text)
readProcessWithExitCode = FilePath -> [FilePath] -> Text -> IO (ExitCode, Text, Text)
forall text char.
ListLikeProcessIO text char =>
FilePath -> [FilePath] -> text -> IO (ExitCode, text, text)
System.Process.Common.readProcessWithExitCode
readCreateProcessWithExitCode
:: CreateProcess
-> Text
-> IO (ExitCode, Text, Text)
readCreateProcessWithExitCode :: CreateProcess -> Text -> IO (ExitCode, Text, Text)
readCreateProcessWithExitCode = CreateProcess -> Text -> IO (ExitCode, Text, Text)
forall maker text char.
(ProcessMaker maker, ListLikeProcessIO text char) =>
maker -> text -> IO (ExitCode, text, text)
System.Process.Common.readCreateProcessWithExitCode