on master help sign in
We'll do it ourselves
bf496c2Jasper Van der Jeugt
hakyll.cabal+2−2
@@ -139,7 +139,7 @@ Library
139 binary >= 0.5 && < 0.8,
139 binary >= 0.5 && < 0.8,
140 blaze-html >= 0.5 && < 0.7,
140 blaze-html >= 0.5 && < 0.7,
141 blaze-markup >= 0.5.1 && < 0.6,
141 blaze-markup >= 0.5.1 && < 0.6,
142− bytestring >= 0.10 && < 0.11,
142+ bytestring >= 0.9 && < 0.11,
143 citeproc-hs >= 0.3.2 && < 0.4,
143 citeproc-hs >= 0.3.2 && < 0.4,
144 containers >= 0.3 && < 0.6,
144 containers >= 0.3 && < 0.6,
145 cryptohash >= 0.7 && < 0.9,
145 cryptohash >= 0.7 && < 0.9,
@@ -213,7 +213,7 @@ Test-suite hakyll-tests
213 binary >= 0.5 && < 0.8,
213 binary >= 0.5 && < 0.8,
214 blaze-html >= 0.5 && < 0.7,
214 blaze-html >= 0.5 && < 0.7,
215 blaze-markup >= 0.5.1 && < 0.6,
215 blaze-markup >= 0.5.1 && < 0.6,
216− bytestring >= 0.10 && < 0.11,
216+ bytestring >= 0.9 && < 0.11,
217 citeproc-hs >= 0.3.2 && < 0.4,
217 citeproc-hs >= 0.3.2 && < 0.4,
218 containers >= 0.3 && < 0.6,
218 containers >= 0.3 && < 0.6,
219 cryptohash >= 0.7 && < 0.9,
219 cryptohash >= 0.7 && < 0.9,
src/Hakyll/Core/UnixFilter.hs+10−7
@@ -9,7 +9,7 @@ module Hakyll.Core.UnixFilter
9--------------------------------------------------------------------------------
9--------------------------------------------------------------------------------
10import Control.Concurrent (forkIO)
10import Control.Concurrent (forkIO)
11import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar)
11import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar)
12−import Control.DeepSeq (NFData, deepseq)
12+import Control.DeepSeq (deepseq)
13import Control.Monad (forM_)
13import Control.Monad (forM_)
14import Data.ByteString.Lazy (ByteString)
14import Data.ByteString.Lazy (ByteString)
15import qualified Data.ByteString.Lazy as LB
15import qualified Data.ByteString.Lazy as LB
@@ -57,7 +57,8 @@ unixFilter = unixFilterWith writer reader
57 hPutStr handle input
57 hPutStr handle input
58 reader handle = do
58 reader handle = do
59 hSetEncoding handle localeEncoding
59 hSetEncoding handle localeEncoding
60− hGetContents handle
60+ out <- hGetContents handle
61+ deepseq out (return out)
61
62
62
63
63--------------------------------------------------------------------------------
64--------------------------------------------------------------------------------
@@ -70,12 +71,14 @@ unixFilterLBS :: String -- ^ Program name
70 -> [String] -- ^ Program args
71 -> [String] -- ^ Program args
71 -> ByteString -- ^ Program input
72 -> ByteString -- ^ Program input
72 -> Compiler ByteString -- ^ Program output
73 -> Compiler ByteString -- ^ Program output
73−unixFilterLBS = unixFilterWith LB.hPutStr LB.hGetContents
74+unixFilterLBS = unixFilterWith LB.hPutStr $ \handle -> do
75+ out <- LB.hGetContents handle
76+ LB.length out `seq` return out
74
77
75
78
76--------------------------------------------------------------------------------
79--------------------------------------------------------------------------------
77-- | Overloaded compiler
80-- | Overloaded compiler
78−unixFilterWith :: (Monoid o, NFData o)
81+unixFilterWith :: Monoid o
79 => (Handle -> i -> IO ()) -- ^ Writer
82 => (Handle -> i -> IO ()) -- ^ Writer
80 -> (Handle -> IO o) -- ^ Reader
83 -> (Handle -> IO o) -- ^ Reader
81 -> String -- ^ Program name
84 -> String -- ^ Program name
@@ -96,7 +99,7 @@ unixFilterWith writer reader programName args input = do
96
99
97--------------------------------------------------------------------------------
100--------------------------------------------------------------------------------
98-- | Internally used function
101-- | Internally used function
99−unixFilterIO :: (Monoid o, NFData o)
102+unixFilterIO :: Monoid o
100 => (Handle -> i -> IO ())
103 => (Handle -> i -> IO ())
101 -> (Handle -> IO o)
104 -> (Handle -> IO o)
102 -> String
105 -> String
@@ -122,14 +125,14 @@ unixFilterIO writer reader programName args input = do
122 -- Read from stdout
125 -- Read from stdout
123 _ <- forkIO $ do
126 _ <- forkIO $ do
124 out <- reader outh
127 out <- reader outh
125− deepseq out (hClose outh)
128+ hClose outh
126 writeIORef outRef out
129 writeIORef outRef out
127 putMVar lock ()
130 putMVar lock ()
128
131
129 -- Read from stderr
132 -- Read from stderr
130 _ <- forkIO $ do
133 _ <- forkIO $ do
131 err <- hGetContents errh
134 err <- hGetContents errh
132− deepseq err (hClose errh)
135+ hClose errh
133 writeIORef errRef err
136 writeIORef errRef err
134 putMVar lock ()
137 putMVar lock ()
135
138