From 1dcb2b58aa3afa6cd5be7c37f71cf42ab8545d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 4 Feb 2025 21:11:22 +0100 Subject: Use 'temporary' package instead of 'mktemp' command Changelog: Fix that empty temorary dir was not deleted in some cases --- src/Job.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Job.hs') 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 -- cgit v1.2.3