diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-02-04 21:11:22 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-02-04 21:11:22 +0100 |
commit | 1dcb2b58aa3afa6cd5be7c37f71cf42ab8545d24 (patch) | |
tree | 1809fd727e65f7181186a4ac347f5e4abac2a45e /src/Job.hs | |
parent | 9eec4cd48404587c939cf2f45a082bba01b47ed9 (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.hs | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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 |