Permalink
Browse files

Fixed Dot plugin to work with GHC 6.12.

We were having string encoding issues reading the output
of dot with readProcess. Solution is to pass dot an output
filename so we don't have to read its output.
  • Loading branch information...
jgm committed May 9, 2010
1 parent 1b42353 commit 41738ed36f990f34e5bf2c2c90358d92e14fc119
Showing with 3 additions and 3 deletions.
  1. +3 −3 plugins/Dot.hs
View
@@ -32,11 +32,11 @@ transformBlock (CodeBlock (_, classes, namevals) contents) | "dot" `elem` classe
Just fn -> ([Str fn], fn ++ ".png")
Nothing -> ([], uniqueName contents ++ ".png")
liftIO $ do
- (ec, out, err) <- readProcessWithExitCode "dot" ["-Tpng"] contents
+ (ec, _out, err) <- readProcessWithExitCode "dot" ["-Tpng", "-o",
+ staticDir cfg </> "img" </> outfile] contents
if ec == ExitSuccess
- then writeFile (staticDir cfg </> "img" </> outfile) out
+ then return $ Para [Image name ("/img" </> outfile, "")]
else error $ "dot returned an error status: " ++ err
- return $ Para [Image name ("/img" </> outfile, "")]
transformBlock x = return x
-- | Generate a unique filename given the file's contents.

0 comments on commit 41738ed

Please sign in to comment.