on master help sign in
Return stdout and stderr when Utils.run fails
1793fd3Evan Czaplicki
src/Elm/Utils.hs+4−3
@@ -33,7 +33,7 @@ infixl 0 |>
33
33
34data CommandError
34data CommandError
35 = MissingExe
35 = MissingExe
36− | CommandFailed String
36+ | CommandFailed (String, String)
37
37
38
38
39{-| Run a command, throw an error if the command is not found or if something
39{-| Run a command, throw an error if the command is not found or if something
@@ -52,7 +52,8 @@ run command args =
52
52
53 message err =
53 message err =
54 case err of
54 case err of
55− CommandFailed msg -> msg
55+ CommandFailed (stderr, stdout) ->
56+ stdout ++ stderr
56 MissingExe ->
57 MissingExe ->
57 "Could not find command '" ++ command ++ "'. Do you have it installed?\n\
58 "Could not find command '" ++ command ++ "'. Do you have it installed?\n\
58 \ Can it be run from anywhere? Is it on your PATH?"
59 \ Can it be run from anywhere? Is it on your PATH?"
@@ -67,7 +68,7 @@ unwrappedRun command args =
67 ExitFailure code
68 ExitFailure code
68 | code == 127 -> Left MissingExe -- UNIX
69 | code == 127 -> Left MissingExe -- UNIX
69 | code == 9009 -> Left MissingExe -- Windows
70 | code == 9009 -> Left MissingExe -- Windows
70− | otherwise -> Left (CommandFailed stderr)
71+ | otherwise -> Left (CommandFailed (stdout, stderr))
71
72
72
73
73-- GET STATIC ASSETS
74-- GET STATIC ASSETS