mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 06:31:18 +02:00
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>
Description
Languages
Shell
93.1%
Python
6.9%