-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #8400 by marking output of cabal list-bin
#8670
Conversation
The regular output of `cabal list-bin` should go to stdout always, but be marked for the sake of the testsuite.
@bacchanalia : I do not understand why the following
The output is just this: cabal/cabal-testsuite/PackageTests/ListBin/Script/cabal.out Lines 2 to 5 in bcfc79c
I'd like to change the assertion into something that would fail if list-bin didn't print the path to the script, but first I'd like to understand why the current check does not fail.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct to me.
That's a puzzling CI failure. Looks like a random corruption, but I can't rule out it's somehow caused by this PR. @andreasabel: could you have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, except for the test result on Windows, which may be wrong due to Windows path separators that, for whatever reason, are not translated properly.
Thanks, good catch: https://github.com/haskell/cabal/actions/runs/3910085986/jobs/6681874680#step:18:138
The path is printed with backslashes under Windows, need to fix my acceptance criterion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know about withOutputMarker
, and thank you for fixing the issue!
@@ -133,7 +133,14 @@ listbinAction flags@NixStyleFlags{..} args globalFlags = do | |||
|
|||
case binfiles of | |||
[] -> die' verbosity "No target found" | |||
[exe] -> info normal exe | |||
[exe] -> putStr $ withOutputMarker verbosity exe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not putStrLn
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, all tests had EOF at the end, so this wasn't visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, putStrLn
would be better in the normal operation. I guess I got pulled towards putStr
because the withOutputMarker
puts the EOL character there:
cabal/Cabal/src/Distribution/Simple/Utils.hs
Lines 622 to 625 in a78d77b
withOutputMarker _ xs = | |
"-----BEGIN CABAL OUTPUT-----\n" ++ | |
withTrailingNewline xs ++ | |
"-----END CABAL OUTPUT-----\n" |
So maybe the correct way is:
putStr $ withOutputMarker verbosity $ exe ++ "\n"
Fix #8400 by marking output of
cabal list-bin
The regular output of
cabal list-bin
should go to stdout always, but be marked for the sake of the testsuite.cabal list-bin
does not produce marked output #8400If this PR is merged quickly, we do not need:
cabal list-bin
" #8668Replaces:
cabal list-bin
#8622