Skip to content

Commit

Permalink
Trim stderr strings before concat
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Mar 11, 2024
1 parent 4c05e5d commit f1b97bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Shrun/IO/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ readHandleResultToStderr :: ReadHandleResult -> Stderr
readHandleResultToStderr ReadNoData = MkStderr "<No data>"
readHandleResultToStderr (ReadErr err) = MkStderr err
readHandleResultToStderr (ReadSuccess errLines) =
MkStderr (T.intercalate " " errLines)
MkStderr (T.intercalate " " $ fmap T.strip errLines)

-- | Attempts to read from the handle.
readHandle ::
Expand Down
6 changes: 3 additions & 3 deletions test/functional/Functional/Miscellaneous.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ spaceStderrLogs = testCase "Stderr Log with newlines is spaced" $ do
args =
withNoConfig
[ "--cmd-log",
"sleep 1 && echo -e 'abc\ndef' && exit 1"
"sleep 1 && echo -e 'abc\n def' && exit 1"
]

-- verifying final 'abc\ndef' log is translated to 'abc def' in the final
-- stderr msg
expected =
[ withErrorPrefix "sleep 1 && echo -e 'abc def' && exit 1" <> "1 second: abc def"
[ withErrorPrefix "sleep 1 && echo -e 'abc def' && exit 1" <> "1 second: abc def"
]
unexpected =
[ withErrorPrefix "sleep 1 && echo -e 'abc def' && exit 1" <> "1 second: abcdef"
[ withErrorPrefix "sleep 1 && echo -e 'abc def' && exit 1" <> "1 second: abcdef"
]

0 comments on commit f1b97bd

Please sign in to comment.