X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FMain.hs;h=1f6d7c5f436a583d5143b05c1cf55aaf4126995e;hp=a1230d60e836c08e849f9c40e78b34e6c4925151;hb=291c39f59e958a012dd6e4ddec9b0276a4045b45;hpb=fc0052e451aa03675ebd9a128dfa46573b9357d7 diff --git a/src/Main.hs b/src/Main.hs index a1230d6..1f6d7c5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -2,12 +2,16 @@ module Main where +import Control.Concurrent.ParallelIO (stopGlobalPool) import System.Directory (doesFileExist) import System.IO ( Handle, IOMode (WriteMode), + hPutStrLn, openBinaryFile, - stdout) + stderr, + stdout + ) import CommandLine (show_help) import Configuration (Cfg(..), get_cfg) @@ -39,11 +43,16 @@ main = do cfg <- case aif of False -> get_login_cookie cfg' True -> return cfg' + page <- page_from_url cfg (article cfg) case page of Just p -> do output_handle <- get_output_handle (output cfg) epublish p output_handle Nothing -> do + hPutStrLn stderr "ERROR: could not parse an LWN page from the given URL." _ <- show_help return () + + -- Necessary, for some reason. + stopGlobalPool