From 980327417d215625b8e7840752eb5f56aadcaed6 Mon Sep 17 00:00:00 2001 From: raywilliams Date: Fri, 10 Apr 2015 09:53:00 -0700 Subject: Catch screenrecord errors to avoid CommandFailedError. BUG=474684 Review URL: https://codereview.chromium.org/1074003002 Cr-Commit-Position: refs/heads/master@{#324647} --- build/android/pylib/screenshot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/android/pylib/screenshot.py b/build/android/pylib/screenshot.py index e21d756..ea939b7 100644 --- a/build/android/pylib/screenshot.py +++ b/build/android/pylib/screenshot.py @@ -2,11 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import logging import os import signal import tempfile from pylib import cmd_helper +from pylib.device import device_errors # TODO(jbudorick) Remove once telemetry gets switched over. import pylib.android_commands @@ -71,7 +73,10 @@ class VideoRecorder(object): self._is_started = False if not self._recorder: return - self._device.KillAll('screenrecord', signum=signal.SIGINT) + try: + self._device.KillAll('screenrecord', signum=signal.SIGINT) + except device_errors.CommandFailedError: + logging.warning('Nothing to kill: screenrecord was not running') self._recorder.wait() def Pull(self, host_file=None): -- cgit v1.1