cros_workon: catch and show errors when eval-uating $(grep ^CROS_WORKON)

Running eval on code grep-ed from other files carries a risk of
errors. For instance, some .ebuild files can have CROS_WORKON*
variable definitions split across several lines, causing cryptic
"syntax error" messages. This code catches invalid grep-ed code before
it can have any side-effect, then displays it and its location as an
ERROR.

BUG=None
TEST=cros_workon info .

Change-Id: I919d55249ae8e9069fb90ca7c6b27dd70f21579f
Reviewed-on: https://chromium-review.googlesource.com/248292
Tested-by: Marc Herbert <marc.herbert@intel.com>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Marc Herbert <marc.herbert@intel.com>
1 file changed