better output

This commit is contained in:
Joey Hess 2013-12-06 15:18:13 -04:00
parent 1910795ddf
commit 5a03e1cacc

View file

@ -116,7 +116,7 @@ getOutput cmd params env = do
runParser' :: Parser a -> String -> a runParser' :: Parser a -> String -> a
runParser' p s = either failedparse id (parse p "" s) runParser' p s = either failedparse id (parse p "" s)
where where
failedparse e = error $ (show e) ++ "\nInput:\n" ++ s failedparse e = error $ (show e) ++ "\n<<<\n" ++ s ++ "\n>>>"
atFile :: FilePath -> String atFile :: FilePath -> String
atFile f = '@':f atFile f = '@':f
@ -135,7 +135,6 @@ main = do
["build", "--ghc-options=-v -keep-tmp-files"] Nothing ["build", "--ghc-options=-v -keep-tmp-files"] Nothing
gccout <- fst <$> runAtFile parseGhcLink ghcout "gcc.opt" ["-v"] gccout <- fst <$> runAtFile parseGhcLink ghcout "gcc.opt" ["-v"]
collect2out <- fst <$> runAtFile parseGccLink gccout "collect2.opt" ["-v"] collect2out <- fst <$> runAtFile parseGccLink gccout "collect2.opt" ["-v"]
writeFile "collect2.out" collect2out
(out, ok) <- runAtFile parseCollect2 collect2out "ld.opt" [] (out, ok) <- runAtFile parseCollect2 collect2out "ld.opt" []
unless ok $ unless ok $
error $ "ld failed:\n" ++ out error $ "ld failed:\n" ++ out