mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-08 03:11:46 +00:00
dev_container: Simplify interactive/tty logic
Always enable interactive mode when a tty is present. This allows commands to receive SIGINT. Otherwise, still allocate a pseudo tty to enable proper console output. BUG=b:275613273 TEST=dev_container presubmit - then CTRL-C Change-Id: I7fb5c6897404f7d3e9f70755c237da0fd8b82c41 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4475490 Reviewed-by: Zihan Chen <zihanchen@google.com> Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
parent
e804cf38d5
commit
25b8e44250
1 changed files with 3 additions and 7 deletions
|
@ -199,7 +199,6 @@ def main(
|
|||
stop: bool = False,
|
||||
clean: bool = False,
|
||||
hermetic: bool = False,
|
||||
interactive: bool = False,
|
||||
use_docker: bool = False,
|
||||
self_test: bool = False,
|
||||
pull: bool = False,
|
||||
|
@ -268,13 +267,10 @@ def main(
|
|||
docker("pull", f"gcr.io/crosvm-infra/crosvm_dev:{DEV_IMAGE_VERSION}").fg()
|
||||
return
|
||||
|
||||
# If a command is provided run non-interactive unless explicitly asked for.
|
||||
tty_args = []
|
||||
if not command or interactive:
|
||||
if not sys.stdin.isatty():
|
||||
raise Exception("Trying to run an interactive session in a non-interactive terminal.")
|
||||
# Default to interactive mode if a tty is present.
|
||||
if sys.stdin.isatty():
|
||||
tty_args = ["--interactive", "--tty"]
|
||||
elif sys.stdin.isatty():
|
||||
else:
|
||||
# Even if run non-interactively, we do want to pass along a tty for proper output.
|
||||
tty_args = ["--tty"]
|
||||
|
||||
|
|
Loading…
Reference in a new issue