Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: build/android/pylib/screenshot.py

Issue 1079113002: [Android] Add a "quiet" flag so KillAll doesn't complain if no processes killed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update pylib/screenshot.py Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import signal 7 import signal
8 import tempfile 8 import tempfile
9 9
10 from pylib import cmd_helper 10 from pylib import cmd_helper
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if self._is_started: 66 if self._is_started:
67 break 67 break
68 return self._is_started 68 return self._is_started
69 69
70 def Stop(self): 70 def Stop(self):
71 """Stop recording video.""" 71 """Stop recording video."""
72 os.remove(self._recorder_stdout) 72 os.remove(self._recorder_stdout)
73 self._is_started = False 73 self._is_started = False
74 if not self._recorder: 74 if not self._recorder:
75 return 75 return
76 try: 76 if not self._device.KillAll('screenrecord', signum=signal.SIGINT,
77 self._device.KillAll('screenrecord', signum=signal.SIGINT) 77 quiet=True):
78 except device_errors.CommandFailedError:
79 logging.warning('Nothing to kill: screenrecord was not running') 78 logging.warning('Nothing to kill: screenrecord was not running')
80 self._recorder.wait() 79 self._recorder.wait()
81 80
82 def Pull(self, host_file=None): 81 def Pull(self, host_file=None):
83 """Pull resulting video file from the device. 82 """Pull resulting video file from the device.
84 83
85 Args: 84 Args:
86 host_file: Path to the video file to store on the host. 85 host_file: Path to the video file to store on the host.
87 Returns: 86 Returns:
88 Output video file name on the host. 87 Output video file name on the host.
89 """ 88 """
90 host_file_name = host_file or ('screen-recording-%s.mp4' % 89 host_file_name = host_file or ('screen-recording-%s.mp4' %
91 self._device.old_interface.GetTimestamp()) 90 self._device.old_interface.GetTimestamp())
92 host_file_name = os.path.abspath(host_file_name) 91 host_file_name = os.path.abspath(host_file_name)
93 self._device.old_interface.EnsureHostDirectory(host_file_name) 92 self._device.old_interface.EnsureHostDirectory(host_file_name)
94 self._device.PullFile(self._device_file, host_file_name) 93 self._device.PullFile(self._device_file, host_file_name)
95 self._device.RunShellCommand('rm -f "%s"' % self._device_file) 94 self._device.RunShellCommand('rm -f "%s"' % self._device_file)
96 return host_file_name 95 return host_file_name
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698