You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's a common misconception that stderr is meant for error messages only. A better way to think about whether to write something to stdout or stderr may be:
When a program produces some output and you redirect stdout when running that program then do you in the common case want this output to be captured (== redirected)? If yes, write it to stdout. If no, write it to stderr.
For purely informational output you don't want it to be captured in the common case.
Note that there are special cases where you want to capture all output, including error message. An example would be a CI system, like Jenkins or GitHub actions.
To Reproduce
Steps to reproduce the behavior:
$ rm -f ~/.config/cabal/config
$ cabal path --installdir > result
$ cat result
Config file path source is default config file.
Config file not found: /home/sol/.config/cabal/config
Writing default configuration to /home/sol/.config/cabal/config
/home/sol/.local/bin
Expected behavior
$ rm -f ~/.config/cabal/config
$ cabal path --installdir > result
Config file path source is default config file.
Config file not found: /home/sol/.config/cabal/config
Writing default configuration to /home/sol/.config/cabal/config
$ cat result
/home/sol/.local/bin
System information
$ cabal --version
cabal-install version 3.12.1.0
compiled using version 3.12.1.0 of the Cabal library
sol
changed the title
Cabal writes purely informational output to stdout instead of stderrcabal path writes purely informational output to stdout instead of stderrJul 14, 2024
sol
changed the title
cabal path writes purely informational output to stdout instead of stderr
Cabal writes purely informational output to stdout instead of stderrJul 14, 2024
sol
changed the title
Cabal writes purely informational output to stdout instead of stderrcabal path writes purely informational output to stdout instead of stderrJul 14, 2024
sol
changed the title
cabal path writes purely informational output to stdout instead of stderr
Cabal writes purely informational output to stdout instead of stderrJul 14, 2024
sol
changed the title
Cabal writes purely informational output to stdout instead of stderrcabal path writes purely informational output to stdout instead of stderrJul 14, 2024
sol
changed the title
cabal path writes purely informational output to stdout instead of stderrcabal path writes purely informational output to stdout instead of stderrJul 14, 2024
There are some design consideration that were not resolved (what should remain on stdout exactly), but they're not that bad: I'd say we could err on the side of sending more to stderr first and then play it by the year (get bug reports and revert part of the output back to stdout).
A bigger technical problem, as funny as it sounds, is adjusting our humongous test suite. I'm still to see a brave soul who would take this on.
I'm tentatively closing this as a duplicate, but feel free to reopen if you disagree.
Describe the bug
I think it's a common misconception that
stderr
is meant for error messages only. A better way to think about whether to write something tostdout
orstderr
may be:stdout
when running that program then do you in the common case want this output to be captured (== redirected)? If yes, write it tostdout
. If no, write it tostderr
.To Reproduce
Steps to reproduce the behavior:
$ rm -f ~/.config/cabal/config
$ cabal path --installdir > result
$ cat result Config file path source is default config file. Config file not found: /home/sol/.config/cabal/config Writing default configuration to /home/sol/.config/cabal/config /home/sol/.local/bin
Expected behavior
$ rm -f ~/.config/cabal/config
System information
Workaround
The text was updated successfully, but these errors were encountered: