Skip to content

Printing current project file to stdout (#10507) breaks the usual list-bin workflow #10547

@ulysses4ever

Description

@ulysses4ever

Describe the bug
After #10507 I can't do the usual trick with assigning the output of cabal list-bin to a shell variable.

To Reproduce

This example uses the changelog-d project but can be any package with an executable in it.

❯ set ch (cabal list-bin exe:changelog-d)   # that's fish equivalent for bash `export ch=$(cabal list-bin...)`
Warning: this is a debug build of cabal-install with assertions enabled.

❯ echo $ch
Configuration is affected by the following files: - cabal.project /home/artem/Dev/cabal/changelogs-3.14/changelog-d-fork/dist-newstyle/build/x86_64-linux/ghc-9.6.5/changelog-d-1.0.1/x/changelog-d/build/changelog-d/changelog-d

Notice that the variable now holds not only the path to the executable but also the message about the project file. Needless to say, this worked before #10507.

Expected behavior

The $ch variable only holds the path.

System information

  • Operating system: NixOS 24.05
  • cabal-head , ghc 9.6.5

How to fix

Besides reverting #10507, we could change the output to stderr (notice how Warning: this is a debug build... works fine). I don't know an easy way to do it except swap notice with warn NVM, it's verboseStderr verbosity

notice verbosity . render . vcat $

This is not morally correct because warn* message are meant for "Non fatal conditions that may be indicative of an error or problem" (according to the docs). But maybe it's okay?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions