From 31b3162768edcd1a22cd74160a830b062ec0386a Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 26 Feb 2017 10:12:55 -0700 Subject: implement finishScanSess forking --- Main.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Main.hs b/Main.hs index 795d396..acc048d 100644 --- a/Main.hs +++ b/Main.hs @@ -111,7 +111,20 @@ abortScanSess st = do & stPageCount .~ Nothing finishScanSess :: St -> IO St -finishScanSess st = undefined +finishScanSess st = do + void $ forkFinally (finishScanSess' st) $ \result -> + case result of + Right _ -> maybe (return ()) + removeDirectoryRecursive + (st^.stScanningSession) + return $ st + & stScanningSession .~ Nothing + & stPageCount .~ Nothing + +-- run OCRmyPDF, pdftk etc., and if any process existed non-zero, +-- record to a log file in the outdir +finishScanSess' :: St -> IO St +finishScanSess' st = undefined scanNextPage :: St -> IO St scanNextPage st = undefined -- cgit v1.2.3