module GitHUD.Process (
  readProcessWithIgnoreExitCode
  ) where

import System.Process (readProcessWithExitCode)
import System.Exit (ExitCode(ExitSuccess))

readProcessWithIgnoreExitCode :: FilePath -> [String] -> String -> IO String
readProcessWithIgnoreExitCode :: FilePath -> [FilePath] -> FilePath -> IO FilePath
readProcessWithIgnoreExitCode FilePath
command [FilePath]
options FilePath
stdin = do
  (ExitCode
exCode, FilePath
stdout, FilePath
_) <- FilePath
-> [FilePath] -> FilePath -> IO (ExitCode, FilePath, FilePath)
readProcessWithExitCode FilePath
command [FilePath]
options FilePath
stdin
  if (ExitCode
exCode ExitCode -> ExitCode -> Bool
forall a. Eq a => a -> a -> Bool
== ExitCode
ExitSuccess)
    then FilePath -> IO FilePath
forall (m :: * -> *) a. Monad m => a -> m a
return FilePath
stdout
    else FilePath -> IO FilePath
forall (m :: * -> *) a. Monad m => a -> m a
return FilePath
""