Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9464b072 authored by Tao Bao's avatar Tao Bao Committed by android-build-merger
Browse files

Merge "releasetools: Add a verbose parameter to common.Run()." am: a149a83e

am: 7d887baf

Change-Id: I00d3fc2ca4f54f9cd3680a091a7d8f0843a8d4b7
parents 21e6dba8 7d887baf
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -41,10 +41,10 @@ def compute_patch(srcfile, tgtfile, imgdiff=False):
  cmd = ['imgdiff', '-z'] if imgdiff else ['bsdiff']
  cmd = ['imgdiff', '-z'] if imgdiff else ['bsdiff']
  cmd.extend([srcfile, tgtfile, patchfile])
  cmd.extend([srcfile, tgtfile, patchfile])


  # Not using common.Run(), which would otherwise dump all the bsdiff/imgdiff
  # Don't dump the bsdiff/imgdiff commands, which are not useful for the case
  # commands when OPTIONS.verbose is True - not useful for the case here, since
  # here, since they contain temp filenames only.
  # they contain temp filenames only.
  p = common.Run(cmd, verbose=False, stdout=subprocess.PIPE,
  p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
                 stderr=subprocess.STDOUT)
  output, _ = p.communicate()
  output, _ = p.communicate()


  if p.returncode != 0:
  if p.returncode != 0:
+9 −4
Original line number Original line Diff line number Diff line
@@ -107,10 +107,15 @@ class ExternalError(RuntimeError):
  pass
  pass




def Run(args, **kwargs):
def Run(args, verbose=None, **kwargs):
  """Create and return a subprocess.Popen object, printing the command
  """Create and return a subprocess.Popen object.
  line on the terminal if -v was specified."""

  if OPTIONS.verbose:
  Caller can specify if the command line should be printed. The global
  OPTIONS.verbose will be used if not specified.
  """
  if verbose is None:
    verbose = OPTIONS.verbose
  if verbose:
    print("  running: ", " ".join(args))
    print("  running: ", " ".join(args))
  return subprocess.Popen(args, **kwargs)
  return subprocess.Popen(args, **kwargs)