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

Commit eb68729b authored by Ying Wang's avatar Ying Wang Committed by Android Git Automerger
Browse files

am 080ed92e: Merge "Close inherited PIPE before doing work" into gingerbread

* commit '080ed92e':
  Close inherited PIPE before doing work
parents e9b1d0ee 080ed92e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ import getopt
import getpass
import imp
import os
import platform
import re
import sha
import shutil
@@ -57,6 +58,22 @@ def Run(args, **kwargs):
  return subprocess.Popen(args, **kwargs)


def CloseInheritedPipes():
  """ Gmake in MAC OS has file descriptor (PIPE) leak. We close those fds
  before doing other work."""
  if platform.system() != "Darwin":
    return
  for d in range(3, 1025):
    try:
      stat = os.fstat(d)
      if stat is not None:
        pipebit = stat[0] & 0x1000
        if pipebit != 0:
          os.close(d)
    except OSError:
      pass


def LoadInfoDict(zip):
  """Read and parse the META/misc_info.txt key/value pairs from the
  input target files and return a dict."""
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ def main(argv):

if __name__ == '__main__':
  try:
    common.CloseInheritedPipes()
    main(sys.argv[1:])
  except common.ExternalError, e:
    print
+1 −0
Original line number Diff line number Diff line
@@ -781,6 +781,7 @@ def main(argv):

if __name__ == '__main__':
  try:
    common.CloseInheritedPipes()
    main(sys.argv[1:])
  except common.ExternalError, e:
    print