factor observe_

This commit is contained in:
Joey Hess 2012-01-02 14:54:23 -04:00
parent 5cd44282a9
commit fc80b8d96b
3 changed files with 10 additions and 13 deletions

View file

@ -172,9 +172,7 @@ withRsyncScratchDir a = do
let tmp = t </> "rsynctmp" </> show pid
nuke tmp
liftIO $ createDirectoryIfMissing True tmp
res <- a tmp
nuke tmp
return res
observe_ (nuke tmp) (a tmp)
where
nuke d = liftIO $
doesDirectoryExist d >>? removeDirectoryRecursive d