Skip to content

Commit 7587cd3

Browse files
carbolymerJimbo4350
authored andcommitted
Fix infinite loop
1 parent e1cf677 commit 7587cd3

File tree

1 file changed

+17
-15
lines changed
  • cardano-testnet/src/Testnet/Process

1 file changed

+17
-15
lines changed

cardano-testnet/src/Testnet/Process/RunIO.hs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{-# LANGUAGE ScopedTypeVariables #-}
66
{-# LANGUAGE TypeApplications #-}
77

8-
module Testnet.Process.RunIO
8+
module Testnet.Process.RunIO
99
( execCli'
1010
, execCli_
1111
, mkExecConfig
@@ -14,27 +14,29 @@ module Testnet.Process.RunIO
1414
) where
1515

1616
import Prelude
17-
import Data.Aeson (eitherDecode)
18-
import Data.Monoid (Last (..))
19-
import Hedgehog.Extras.Internal.Plan (Component (..), Plan (..))
20-
import RIO
21-
import System.FilePath (takeDirectory)
22-
import System.FilePath.Posix ((</>))
23-
import System.Process (CreateProcess (..))
2417

2518
import Control.Exception.Annotated (exceptionWithCallStack)
19+
import Data.Aeson (eitherDecode)
2620
import qualified Data.ByteString.Lazy as LBS
2721
import qualified Data.List as L
22+
import Data.Monoid (Last (..))
2823
import qualified Data.Text as T
2924
import qualified GHC.Stack as GHC
30-
import qualified Hedgehog.Extras.Stock.OS as OS
31-
import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO
32-
import Hedgehog.Extras.Test.Process (ExecConfig(..))
3325
import qualified System.Directory as IO
3426
import qualified System.Environment as IO
3527
import qualified System.Exit as IO
28+
import System.FilePath (takeDirectory)
29+
import System.FilePath.Posix ((</>))
3630
import qualified System.IO.Unsafe as IO
3731
import qualified System.Process as IO
32+
import System.Process (CreateProcess (..))
33+
34+
import Hedgehog.Extras.Internal.Plan (Component (..), Plan (..))
35+
import qualified Hedgehog.Extras.Stock.IO.Network.Sprocket as IO
36+
import qualified Hedgehog.Extras.Stock.OS as OS
37+
import Hedgehog.Extras.Test.Process (ExecConfig (..))
38+
39+
import RIO
3840

3941

4042

@@ -116,8 +118,8 @@ execFlex'
116118
execFlex' execConfig pkgBin envBin arguments = GHC.withFrozenCallStack $ do
117119
(exitResult, stdout', _stderr) <- execFlexAny' execConfig pkgBin envBin arguments
118120
case exitResult of
119-
IO.ExitFailure exitCode -> throwString $
120-
unlines $
121+
IO.ExitFailure exitCode -> throwString $
122+
unlines $
121123
[ "Process exited with non-zero exit-code: " ++ show @Int exitCode ]
122124
++ (if L.null stdout' then [] else ["━━━━ stdout ━━━━" , stdout'])
123125
++ (if L.null _stderr then [] else ["━━━━ stderr ━━━━" , _stderr])
@@ -289,6 +291,6 @@ procFlex
289291
procFlex = procFlex' defaultExecConfig
290292

291293
-- This will also catch async exceptions as well.
292-
liftIOAnnotated :: (HasCallStack, MonadIO m) => IO a -> m a
294+
liftIOAnnotated :: (HasCallStack, MonadIO m) => IO a -> m a
293295
liftIOAnnotated action = GHC.withFrozenCallStack $
294-
liftIOAnnotated $ action `catch` (\(e :: SomeException) -> throwM $ exceptionWithCallStack e)
296+
liftIO $ action `catch` (\(e :: SomeException) -> throwM $ exceptionWithCallStack e)

0 commit comments

Comments
 (0)