Skip to content

Commit

Permalink
Do not strip whitespace at the start of stdout/stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
9999years committed Sep 6, 2024
1 parent 8d0cd21 commit cbb81ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
- stm
- transformers
- unliftio-core
- text >=2.0

library:
source-dirs: src
Expand Down
2 changes: 1 addition & 1 deletion src/System/Process/Typed/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ data ExitCodeException = ExitCodeException
instance Exception ExitCodeException
instance Show ExitCodeException where
show ece =
let decodeStrip = T.unpack . T.strip . TL.toStrict . TLE.decodeUtf8With lenientDecode
let decodeStrip = T.unpack . T.stripEnd . TL.toStrict . TLE.decodeUtf8With lenientDecode
stdout = decodeStrip $ eceStdout ece
stderr = decodeStrip $ eceStderr ece
stdout' = if null stdout
Expand Down
4 changes: 2 additions & 2 deletions test/System/Process/TypedSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ spec = do
++ "Raw command: detect-doggies\n"
++ "\n"
++ "Standard output:\n"
++ "puppy\n"
++ "\n\npuppy\n"
++ "\n"
++ "Standard error:\n"
++ "doggy"
++ "\t \ndoggy"

it "Show displays correctly with no newlines in stdout" $ do
-- Sometimes, commands don't output _any_ newlines!
Expand Down

0 comments on commit cbb81ae

Please sign in to comment.