packages feed

filepather-0.5.4: src/System/FilePath/FilePather/Process.hs

{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE NoImplicitPrelude #-}

module System.FilePath.FilePather.Process(
  spawnProcess
, showCommandForUser
, readProcess
, proc
, callProcess
, readProcessWithExitCode
) where

import Control.Exitcode as E
import Control.Exception
import Control.Monad.Reader.Class
import Control.Process( ProcessHandle, CreateProcess )
import qualified Control.Process as P
import System.FilePath.FilePather.ReadFilePath
import Prelude

spawnProcess ::
  Exception e =>
  [String]
  -> ReadFilePathT e IO ProcessHandle
spawnProcess x =
  tryReadFilePath (`P.spawnProcess` x)

showCommandForUser ::
  [String]
  -> ReadFilePath e String
showCommandForUser x =
  reader (`P.showCommandForUser` x)

readProcess ::
  Exception e =>
  [String]
  -> String
  -> ReadFilePathT e IO String
readProcess args i =
  tryReadFilePath (\p -> P.readProcess p args i)

proc ::
  [String]
  -> ReadFilePath e CreateProcess
proc s =
  reader (`P.proc` s)

callProcess ::
  Exception e =>
  [String]
  -> ReadFilePathT e IO ()
callProcess s =
  tryReadFilePath (`P.callProcess` s)

readProcessWithExitCode ::
  [String]
  -> String
  -> ReadFilePathT e (ExitcodeT IO (String, String)) (String, String)
readProcessWithExitCode as a =
  successReadFilePath (\p -> P.readProcessWithExitCode p as a)