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 | |
| parent | 9eec4cd48404587c939cf2f45a082bba01b47ed9 (diff) | |
Use 'temporary' package instead of 'mktemp' command
Changelog: Fix that empty temorary dir was not deleted in some cases
| -rw-r--r-- | minici.cabal | 1 | ||||
| -rw-r--r-- | src/Job.hs | 6 | 
2 files changed, 3 insertions, 4 deletions
| diff --git a/minici.cabal b/minici.cabal index 536083d..560282b 100644 --- a/minici.cabal +++ b/minici.cabal @@ -97,6 +97,7 @@ executable minici          process ^>= { 1.6 },          stm ^>= { 2.5 },          template-haskell ^>= { 2.17, 2.18, 2.19, 2.20, 2.21, 2.22, 2.23 }, +        temporary ^>= { 1.3 },          text ^>= { 1.2, 2.0, 2.1 },          th-compat ^>= { 0.1 },          unix ^>= { 2.7.3, 2.8.6 }, @@ -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 |