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
Hi!
I am confused regarding the stdout and stderr streams:
conan_run
All processes started with conan_run redirect stdout to stderr,
the docu says "Instead of print to sys.stdout print to that stream" but it is initialized with sys.stderr.
A typo?
However, i can control the streams with the stderr option.
ConanOutput
All messages (info, warning, error) are written to stderr.
In my opinion, this should be stdout for info and stderr for error and popably warning.
Can you explain the background?
Thank you.
Have you read the CONTRIBUTING guide?
I've read the CONTRIBUTING guide
The text was updated successfully, but these errors were encountered:
For the first part, yes, that seems a typo in the conan_run docstring but please, be aware that conan_run is not meant to be public and be used outside the internal code for Conan. To run external commands in recipes please use Conanfile's run method, like explained in the docs: https://docs.conan.io/2/reference/conanfile/running_and_output.html
Regarding ConanOutput, the the decision to send all messages, but the final output of the command, including info, warnings, and errors, to stderr follows a deliberate design choice that aligns with common practices in many CLI tools and the POSIX standard (you'll see that it defines standard output (for writing conventional output) and standard error (for writing diagnostic output) so stderr is not only used for errors but all kinds of informative messages).
For Conan, the separation allows the main data output of commands to be cleanly directed to stdout, while diagnostic and auxiliary information (like logs, progress bars, and status messages) is sent to stderr.
For example, if you're running a command like conan install and want to capture its main output in a file (e.g., in JSON format), you can redirect stdout to a file without mixing it with diagnostic messages. This approach is used by many well-known tools like git, curl, wget, rsync, and others.
Hope this helps, please don't hesitate to reach out if you have any further questions or need additional clarification!
#17507 adds a new --output-file to enforce writing the result in that file irrespective of the stdout redirections or other possible issues. It will be in next Conan 2.12. Thanks for the feedback!
What is your question?
Hi!
I am confused regarding the stdout and stderr streams:
conan_run
All processes started with conan_run redirect stdout to stderr,
the docu says "Instead of print to sys.stdout print to that stream" but it is initialized with sys.stderr.
A typo?
However, i can control the streams with the stderr option.
ConanOutput
All messages (info, warning, error) are written to stderr.
In my opinion, this should be stdout for info and stderr for error and popably warning.
Can you explain the background?
Thank you.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: