Chris Wolfe 21a27b75e9 scripts: Add functions to detect an interactive terminal
With more interactive features appearing in the scripts, we need to
avoid hanging buildbots waiting for user input. This changes adds
utility functions to test whether and ensure that the execution is
interactive, and adds an assertion to the 'choose' function.

is_interactive: Check that both stdin and stderr are terminals.
assert_interactive: Die with an error if not interactive

Also tweaking 'choose' so that its menu is printed to stderr,
for consistency with read -p and select.

BUG=None
TEST=Modified setup_board to log the value of is_interactive, and
  then (unconditionally) attempt to display a menu.
  Running setup_board in a terminal showed interactive and the menu.
  Manually run cbuildbot x86-generic-pfq showed non-interactive and
  the assertion failure.

Change-Id: I768a37b8b85ce036edac7c9bb0fd1e0a2b92ecd5
Reviewed-on: https://gerrit.chromium.org/gerrit/16817
Commit-Ready: Chris Wolfe <cwolfe@chromium.org>
Reviewed-by: Chris Wolfe <cwolfe@chromium.org>
Tested-by: Chris Wolfe <cwolfe@chromium.org>
2012-02-28 13:57:05 -08:00
2011-11-16 20:02:45 -08:00
2011-12-14 20:57:10 -08:00
2011-08-26 13:04:29 -07:00
2011-09-08 17:05:10 -07:00
2011-10-25 14:38:29 -07:00
2012-02-27 15:28:10 -08:00
Description
image build and composition scripts for Flatcar Container Linux
BSD-3-Clause 165 MiB
Languages
Shell 93.1%
Python 6.9%