aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-26 10:12:55 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-26 10:14:04 -0700
commit31b3162768edcd1a22cd74160a830b062ec0386a (patch)
treedde6d476358ca11c9ff854ee05a21f9eaec9d5a1
parent0e5b23214e1e1ffd6b9fc98e91d630225a823aff (diff)
downloadsscan-31b3162768edcd1a22cd74160a830b062ec0386a.tar.gz
implement finishScanSess forking
-rw-r--r--Main.hs15
1 files changed, 14 insertions, 1 deletions
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