@@ -44,7 +44,7 @@ import Hedgehog (MonadTest)
44
44
import Hedgehog.Extras.Internal.Cli (argQuote )
45
45
import Hedgehog.Extras.Internal.Plan (Component (.. ), Plan (.. ))
46
46
import Hedgehog.Extras.Stock.IO.Process (TimedOut (.. ))
47
- import Prelude (error )
47
+ import Prelude (error , (++) )
48
48
import System.Exit (ExitCode )
49
49
import System.FilePath (takeDirectory )
50
50
import System.FilePath.Posix ((</>) )
@@ -173,16 +173,12 @@ execFlex' execConfig pkgBin envBin arguments = GHC.withFrozenCallStack $ do
173
173
case exitResult of
174
174
IO. ExitFailure exitCode -> do
175
175
H. annotate $ L. unlines $
176
- [ " Process exited with non-zero exit-code"
176
+ [ " Process exited with non-zero exit-code: " ++ show @ Int exitCode
177
177
, " ━━━━ command ━━━━"
178
178
, pkgBin <> " " <> L. unwords (fmap argQuote arguments)
179
- , " ━━━━ stdout ━━━━"
180
- , stdout
181
- , " ━━━━ stderr ━━━━"
182
- , stderr
183
- , " ━━━━ exit code ━━━━"
184
- , show @ Int exitCode
185
179
]
180
+ ++ if L. null stdout then [] else [" ━━━━ stdout ━━━━" , stdout]
181
+ ++ if L. null stderr then [] else [" ━━━━ stderr ━━━━" , stderr]
186
182
H. failMessage GHC. callStack " Execute process failed"
187
183
IO. ExitSuccess -> return stdout
188
184
@@ -208,16 +204,12 @@ exec execConfig bin arguments = GHC.withFrozenCallStack $ do
208
204
(exitResult, stdout, stderr) <- execAny execConfig bin arguments
209
205
case exitResult of
210
206
IO. ExitFailure exitCode -> H. failMessage GHC. callStack . L. unlines $
211
- [ " Process exited with non-zero exit-code"
207
+ [ " Process exited with non-zero exit-code: " ++ show @ Int exitCode
212
208
, " ━━━━ command ━━━━"
213
209
, bin <> " " <> L. unwords (fmap argQuote arguments)
214
- , " ━━━━ stdout ━━━━"
215
- , stdout
216
- , " ━━━━ stderr ━━━━"
217
- , stderr
218
- , " ━━━━ exit code ━━━━"
219
- , show @ Int exitCode
220
210
]
211
+ ++ if L. null stdout then [] else [" ━━━━ stdout ━━━━" , stdout]
212
+ ++ if L. null stderr then [] else [" ━━━━ stderr ━━━━" , stderr]
221
213
IO. ExitSuccess -> return stdout
222
214
223
215
-- | Execute a process, returning the error code, the stdout, and the stderr.
0 commit comments