]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blobdiff - src/LWN/Page.hs
Final cleanups to get the download working.
[dead/lwn-epub.git] / src / LWN / Page.hs
index 7419402a3af304974dac87236826b4fcd8f545ae..bdfe8ca40ad18c38e549dd8dbf65718eedb1c366 100644 (file)
@@ -5,7 +5,7 @@ where
 
 import qualified Data.Map as Map
 import Data.Time (getCurrentTime)
-import System.IO (Handle)
+import System.IO (Handle, hClose, hFlush)
 import qualified Data.ByteString.Lazy as B (ByteString, hPut)
 import Data.String.Utils (split, strip)
 import Data.Maybe (catMaybes, fromJust, isNothing)
@@ -393,7 +393,8 @@ epublish obj handle = do
   epmd <- metadata obj
   epub <- xhtml_to_epub epmd xhtml
   B.hPut handle epub
-
+  hFlush handle
+  hClose handle
 
 xhtml_to_epub :: String -> String -> IO B.ByteString
 xhtml_to_epub epmd =