diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-26 10:12:55 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2017-02-26 10:14:04 -0700 |
commit | 31b3162768edcd1a22cd74160a830b062ec0386a (patch) | |
tree | dde6d476358ca11c9ff854ee05a21f9eaec9d5a1 | |
parent | 0e5b23214e1e1ffd6b9fc98e91d630225a823aff (diff) | |
download | sscan-31b3162768edcd1a22cd74160a830b062ec0386a.tar.gz |
implement finishScanSess forking
-rw-r--r-- | Main.hs | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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 |