readProcess' :: String -> [String] -> IO String
readProcess' cmd opts = do
  (rv,output,err) <- readProcessWithExitCode cmd opts ""
  case rv of
    ExitFailure val -> do
        hPutStrLn stderr err
        fail $ cmd ++ " " ++ unwords opts ++ " (exit " ++ show val ++ ")"
    ExitSuccess ->
        return output
readProcess' :: String -> [String] -> IO String
readProcess' cmd opts = do
  (rv,output,err) <- readProcessWithExitCode cmd opts ""
  case rv of
    ExitFailure val -> do
        hPutStrLn stderr err
        fail $ cmd ++ " " ++ unwords opts ++ " (exit " ++ show val ++ ")"
    ExitSuccess ->
        return output
readProcess' cmd opts = do
  (rv,output,err) <- readProcessWithExitCode cmd opts ""
  case rv of
    ExitFailure val -> do
        hPutStrLn stderr err
        fail $ cmd ++ " " ++ unwords opts ++ " (exit " ++ show val ++ ")"
    ExitSuccess ->
        return output