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

Unified Diff: build/android/pylib/cmd_helper.py

Issue 60043003: [android] Add timeout_retry module to pylib/utils/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/utils/timeout_retry.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/cmd_helper.py
diff --git a/build/android/pylib/cmd_helper.py b/build/android/pylib/cmd_helper.py
index dba399f8193f333ebcc94a880cb540ba83d90976..4047b87e9741bc67f4ced682c6187265c34c0aed 100644
--- a/build/android/pylib/cmd_helper.py
+++ b/build/android/pylib/cmd_helper.py
@@ -4,14 +4,13 @@
"""A wrapper for subprocess to make calling shell commands easier."""
-import os
import logging
import pipes
import signal
import subprocess
import tempfile
-import constants
+from utils import timeout_retry
def Popen(args, stdout=None, stderr=None, shell=None, cwd=None, env=None):
@@ -73,7 +72,7 @@ def GetCmdStatusAndOutput(args, cwd=None, shell=False):
shell: Whether to execute args as a shell command.
Returns:
- The tuple (exit code, output).
+ The 2-tuple (exit code, output).
"""
if isinstance(args, basestring):
args_repr = args
@@ -104,3 +103,18 @@ def GetCmdStatusAndOutput(args, cwd=None, shell=False):
logging.debug('Truncated output:')
logging.debug(stdout[:4096])
return (exit_code, stdout)
+
+
+def GetCmdStatusAndOutputWithTimeoutAndRetries(args, timeout, retries):
+ """Executes a subprocess with a timeout and retries.
+
+ Args:
+ args: List of arguments to the program, the program to execute is the first
+ element.
+ timeout: the timeout in seconds.
+ retries: the number of retries.
+
+ Returns:
+ The 2-tuple (exit code, output).
+ """
+ return timeout_retry.Run(GetCmdStatusAndOutput, timeout, retries, [args])
« no previous file with comments | « no previous file | build/android/pylib/utils/timeout_retry.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698