Skip to content

Commit

Permalink
cosmetic: use nicer indentation and if style
Browse files Browse the repository at this point in the history
  • Loading branch information
process-bot committed Nov 20, 2015
1 parent cb1bad3 commit 50d4efb
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/Elm/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ run :: (MonadError String m, MonadIO m) => String -> [String] -> m String
run command args =
do result <- liftIO (unwrappedRun command args)
case result of
Right out -> return out
Right out ->
return out

Left err ->
throwError (context (message err))
where
Expand All @@ -70,6 +72,7 @@ run command args =
case err of
CommandFailed stderr stdout ->
stdout ++ stderr

MissingExe msg ->
msg

Expand All @@ -79,11 +82,18 @@ unwrappedRun command args =
do (exitCode, stdout, stderr) <- readProcessWithExitCode command args ""
return $
case exitCode of
ExitSuccess -> Right stdout
ExitFailure code
| code == 127 -> Left (missingExe command) -- UNIX
| code == 9009 -> Left (missingExe command) -- Windows
| otherwise -> Left (CommandFailed stdout stderr)
ExitSuccess ->
Right stdout

ExitFailure code ->
if code == 127 then
Left (missingExe command) -- UNIX

else if code == 9009 then
Left (missingExe command) -- Windows

else
Left (CommandFailed stdout stderr)


missingExe :: String -> CommandError
Expand Down

0 comments on commit 50d4efb

Please sign in to comment.