dev_container: Always pass tty to docker if available

This allows programs to use colors and other tty features. It also
fixes issues with stdout being buffered instead of printed in real
time.

BUG=b:246623045
TEST=./tools/dev_container ./tools/health-check --all -v

Change-Id: I09dd7523a15fbd8b3c5c653471ef091eac75cf6d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892522
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Dennis Kempin 2022-09-13 20:27:08 +00:00 committed by crosvm LUCI
parent 33f90e6eb0
commit 60911dbc02

View file

@ -170,6 +170,9 @@ def main(
if not sys.stdin.isatty():
raise Exception("Trying to run an interactive session in a non-interactive terminal.")
tty_args = ["--interactive", "--tty"]
elif sys.stdin.isatty():
# Even if run non-interactively, we do want to pass along a tty for proper output.
tty_args = ["--tty"]
# Start an interactive shell by default
if hermetic: