utils/android: Don't lock up if LogcatMonitor stopped before start
Calling stop before start will result in hanging in self._started.wait(),
because that event will never get set. Although stop before start is an illegal
usage pattern, let's try not to fail annoyingly.
diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index fd4c42e..bbc4b9d 100644
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -589,6 +589,10 @@
self._add_line(line)
def stop(self):
+ if not self.is_alive():
+ logger.warning('LogcatMonitor.stop called before start')
+ return
+
# Make sure we've started before we try to kill anything
self._started.wait()