Skip to content

Commit 11af036

Browse files
Use getTemporaryDirectory for Windows/Posix portability
1 parent af3e918 commit 11af036

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • test/Streamly/Test/Coreutils

test/Streamly/Test/Coreutils/Rm.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import System.Directory
4343
, createDirectoryLink
4444
, createFileLink
4545
, doesPathExist
46+
, getTemporaryDirectory
4647
)
4748
import System.FilePath ((</>))
4849
import System.IO.Temp (createTempDirectory)
@@ -71,9 +72,10 @@ import Streamly.Coreutils.Rm
7172

7273
-- | Run a test inside a fresh temporary directory, cleaning up afterwards.
7374
withTempDir :: (FilePath -> IO ()) -> IO ()
74-
withTempDir action =
75+
withTempDir action = do
76+
tmpRoot <- getTemporaryDirectory
7577
bracket
76-
(createTempDirectory "/tmp" "rm-test-")
78+
(createTempDirectory tmpRoot "rm-test-")
7779
removePathForcibly'
7880
action
7981
where

0 commit comments

Comments
 (0)