Skip to content

Commit e0e9367

Browse files
committed
Replace broken file existence test with doesFileExist.
1 parent 9a645e5 commit e0e9367

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rules_haskell_tests/tests/RunTests.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Control.Exception.Safe (bracket_)
77
import Data.Foldable (for_)
88
import Data.List (isInfixOf, sort)
99
import GHC.Stack (HasCallStack)
10-
import System.Directory (copyFile)
10+
import System.Directory (copyFile, doesFileExist)
1111
import System.FilePath ((</>))
1212
import System.Info (os)
1313
import System.IO.Temp (withSystemTempDirectory)
@@ -202,10 +202,10 @@ topPath = "/usr/bin/top"
202202
printMemory :: String -> IO ()
203203
printMemory msg = do
204204
-- Do not attempt to run top, if it does not exist.
205-
(exitCode, _, _) <- Process.readProcessWithExitCode "test" [topPath] ""
206-
case exitCode of
207-
ExitSuccess -> _doPrintMemory msg
208-
ExitFailure _ -> pure ()
205+
topExists <- doesFileExist topPath
206+
if topExists
207+
then _doPrintMemory msg
208+
else pure()
209209

210210
-- | Print information about the current memory state to debug intermittent failures
211211
-- Related to https://github.com/tweag/rules_haskell/issues/2089

0 commit comments

Comments
 (0)