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
stderr merged into stdout when using a tty #25542
Comments
Yes, the tty multiplexes stdout and stderr onto a single stream. This is the normal behavior of a tty. |
Thanks for the quick reply. Even though this is the normal behaviour of a tty, I reported it mostly because it felt like an unexpected behaviour of docker. Especially when using cli tools in development environment, it is sometimes useful to distinguish between stdout and stderr, but depending on the Then I don't know if / how this behaviour could be changed in docker, maybe having 2 separate ttys? |
@bamarni The solution would really be to not include |
In development environment I always add the When running this script indeed I won't always need to type something, nor need the ssh agent forwarding, but it happens often. It'd really be time consuming to type the minimal docker command required just to run a cli tool in development, that's why I opted for full-featured helper scripts. |
How about this: tty=""
if [ -t 1 ] ; then
tty="-t"
fi
docker run -i $tty --rm ...
(http://stackoverflow.com/questions/911168/how-to-detect-if-my-shell-script-is-running-through-a-pipe) |
Thanks @dnephin, very interesting idea. I'll give it a shot and post here again if I find some edge cases, hopefully not 😺 |
Docker merges stderr into stdout when `--tty` is set [1]. This was the only test I found with this case. [1]: moby/moby#25542
Docker merges stderr into stdout when `--tty` is set [1]. This was the only test I found with this case. [1]: moby/moby#25542
Docker merges stderr into stdout when `--tty` is set [1]. This was the only test I found with this case. [1]: moby/moby#25542
Output of
docker version
:Output of
docker info
:Steps to reproduce the issue:
docker run -t --rm debian:jessie bash -c "echo stdout && echo stderr >&2" 2>/dev/null
Describe the results you received:
Describe the results you expected:
I expected to only see
stdout
, butstderr
seems to be merged with it, because of the tty option?The text was updated successfully, but these errors were encountered: