cros_workon: handle equery output better

If equery writes messages to stderr in addition to giving back the data
we care about, we end up in an infinite loop where we try to complete
the package name forever.

Rather than use stderr as a signal of failure, check the exit status.
The current equery version exits non-zero when it can't match, and it
still writes the data we want to stdout even if warnings are on stdout.

BUG=None
TEST=`cros_workon-samus start chromeos-kernel-3_14` doesn't loop forever

Change-Id: Ie72a278d31fb323cdac7f80ba9c2ea7b9cd7d706
Reviewed-on: https://chromium-review.googlesource.com/295332
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David Pursell <dpursell@chromium.org>
2 files changed