@@ -32,8 +32,8 @@ infixl 0 |>
32-- RUN EXECUTABLES
32-- RUN EXECUTABLES
34data CommandError
34data CommandError
35− = MissingExe
35+ = MissingExe String
36− | CommandFailed (String, String)
36+ | CommandFailed String String
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,11 +52,10 @@ run command args =
53 message err =
53 message err =
54 case err of
54 case err of
55− CommandFailed (stderr, stdout) ->
55+ CommandFailed stderr stdout ->
56 stdout ++ stderr
56 stdout ++ stderr
57− MissingExe ->
57+ MissingExe msg ->
58− "Could not find command '" ++ command ++ "'. Do you have it installed?\n\
58+ msg
59− \ Can it be run from anywhere? Is it on your PATH?"
62unwrappedRun :: String -> [String] -> IO (Either CommandError String)
61unwrappedRun :: String -> [String] -> IO (Either CommandError String)
@@ -66,9 +65,17 @@ unwrappedRun command args =
66 case exitCode of
65 case exitCode of
67 ExitSuccess -> Right stdout
66 ExitSuccess -> Right stdout
68 ExitFailure code
67 ExitFailure code
69− | code == 127 -> Left MissingExe -- UNIX
68+ | code == 127 -> Left (missingExe command) -- UNIX
70− | code == 9009 -> Left MissingExe -- Windows
69+ | code == 9009 -> Left (missingExe command) -- Windows
71− | otherwise -> Left (CommandFailed (stdout, stderr))
70+ | otherwise -> Left (CommandFailed stdout stderr)
73+missingExe :: String -> CommandError
76+ "Could not find command '" ++ command ++ "'. Do you have it installed?\n\
77+ \ Can it be run from anywhere? Is it on your PATH?"
74-- GET STATIC ASSETS
81-- GET STATIC ASSETS