summaryrefslogtreecommitdiff
path: root/src/Job.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-02-04 21:11:22 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-02-04 21:11:22 +0100
commit1dcb2b58aa3afa6cd5be7c37f71cf42ab8545d24 (patch)
tree1809fd727e65f7181186a4ac347f5e4abac2a45e /src/Job.hs
parent9eec4cd48404587c939cf2f45a082bba01b47ed9 (diff)
Use 'temporary' package instead of 'mktemp' command
Changelog: Fix that empty temorary dir was not deleted in some cases
Diffstat (limited to 'src/Job.hs')
-rw-r--r--src/Job.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Job.hs b/src/Job.hs
index 71da738..cf7dde8 100644
--- a/src/Job.hs
+++ b/src/Job.hs
@@ -31,6 +31,7 @@ import System.Directory
import System.Exit
import System.FilePath
import System.IO
+import System.IO.Temp
import System.Posix.Signals
import System.Process
@@ -280,10 +281,7 @@ updateStatusFile path outVar = void $ liftIO $ forkIO $ loop Nothing
prepareJob :: (MonadIO m, MonadMask m, MonadFail m) => FilePath -> Commit -> Job -> (FilePath -> FilePath -> m a) -> m a
prepareJob dir commit job inner = do
- [checkoutPath] <- fmap lines $ liftIO $
- readProcess "mktemp" ["-d", "-t", "minici.XXXXXXXXXX"] ""
-
- flip finally (liftIO $ removeDirectoryRecursive checkoutPath) $ do
+ withSystemTempDirectory "minici" $ \checkoutPath -> do
checkoutAt commit checkoutPath
tid <- getTreeId commit