on master help sign in
Switch to more traditional style
commitce40d5e6d53d9c8e35de8beb08a70dea5f282bf8 authorEvan Czaplicki <info@elm-lang.org> dateTue 18 Nov 2014, 16:37 (12 years ago) parent1793fd3
1 file changed+16−9
src/Elm/Utils.hs+16−9
src/Elm/Utils.hs+16−9
@@ -32,8 +32,8 @@ infixl 0 |>
3232-- RUN EXECUTABLES
3333
3434data CommandError
35− = MissingExe
36− | CommandFailed (String, String)
35+ = MissingExe String
36+ | CommandFailed String String
3737
3838
3939{-| Run a command, throw an error if the command is not found or if something
@@ -52,11 +52,10 @@ run command args =
5252
5353 message err =
5454 case err of
55− CommandFailed (stderr, stdout) ->
55+ CommandFailed stderr stdout ->
5656 stdout ++ stderr
57− MissingExe ->
58− "Could not find command '" ++ command ++ "'. Do you have it installed?\n\
59− \ Can it be run from anywhere? Is it on your PATH?"
57+ MissingExe msg ->
58+ msg
6059
6160
6261unwrappedRun :: String -> [String] -> IO (Either CommandError String)
@@ -66,9 +65,17 @@ unwrappedRun command args =
6665 case exitCode of
6766 ExitSuccess -> Right stdout
6867 ExitFailure code
69− | code == 127 -> Left MissingExe -- UNIX
70− | code == 9009 -> Left MissingExe -- Windows
71− | otherwise -> Left (CommandFailed (stdout, stderr))
68+ | code == 127 -> Left (missingExe command) -- UNIX
69+ | code == 9009 -> Left (missingExe command) -- Windows
70+ | otherwise -> Left (CommandFailed stdout stderr)
71+
72+
73+missingExe :: String -> CommandError
74+missingExe command =
75+ MissingExe $
76+ "Could not find command '" ++ command ++ "'. Do you have it installed?\n\
77+ \ Can it be run from anywhere? Is it on your PATH?"
78+
7279
7380
7481-- GET STATIC ASSETS