What should go to stdout/stderr and why Python logging write everything to stderr?

Barry Scott barry at barrys-emacs.org
Wed Jan 4 10:29:35 EST 2023


On 04/01/2023 02:26, Chris Angelico wrote:
> Reading/writing the FD is the same as using stdout (technically you'd
> write to fd 1 and read from fd 0), but yes, can use /dev/tty to reach
> for the console directly.

I think the logic is more like checking that stdin is a tty then using
the tty it to read and write the tty. This works with stdout redirected.
Also stdin is likely only open with read access.

For example the way to prevent ssh-add from prompting in the terminal is 
this:

$ ssh-add ~/.ssh/id_rsa </dev/null

It will then use the SSH_ASKPASS program.

Barry





More information about the Python-list mailing list