Bug 1053911 - Uplift Add-on SDK to Firefox r=me
This commit is contained in:
@@ -126,7 +126,7 @@ class Popen(subprocess.Popen):
|
||||
|
||||
if not isinstance(args, types.StringTypes):
|
||||
args = subprocess.list2cmdline(args)
|
||||
|
||||
|
||||
# Always or in the create new process group
|
||||
creationflags |= winprocess.CREATE_NEW_PROCESS_GROUP
|
||||
|
||||
@@ -135,7 +135,7 @@ class Popen(subprocess.Popen):
|
||||
|
||||
if None not in (p2cread, c2pwrite, errwrite):
|
||||
startupinfo.dwFlags |= winprocess.STARTF_USESTDHANDLES
|
||||
|
||||
|
||||
startupinfo.hStdInput = int(p2cread)
|
||||
startupinfo.hStdOutput = int(c2pwrite)
|
||||
startupinfo.hStdError = int(errwrite)
|
||||
@@ -172,7 +172,7 @@ class Popen(subprocess.Popen):
|
||||
|
||||
if canCreateJob:
|
||||
# We create a new job for this process, so that we can kill
|
||||
# the process and any sub-processes
|
||||
# the process and any sub-processes
|
||||
self._job = winprocess.CreateJobObject()
|
||||
winprocess.AssignProcessToJobObject(self._job, int(hp))
|
||||
else:
|
||||
@@ -198,7 +198,7 @@ class Popen(subprocess.Popen):
|
||||
winprocess.TerminateJobObject(self._job, 127)
|
||||
else:
|
||||
winprocess.TerminateProcess(self._handle, 127)
|
||||
self.returncode = 127
|
||||
self.returncode = 127
|
||||
else:
|
||||
if group:
|
||||
try:
|
||||
@@ -223,7 +223,7 @@ class Popen(subprocess.Popen):
|
||||
if timeout is None:
|
||||
timeout = -1
|
||||
rc = winprocess.WaitForSingleObject(self._handle, timeout)
|
||||
|
||||
|
||||
if (rc == winprocess.WAIT_OBJECT_0 or
|
||||
rc == winprocess.WAIT_ABANDONED or
|
||||
rc == winprocess.WAIT_FAILED):
|
||||
@@ -232,11 +232,11 @@ class Popen(subprocess.Popen):
|
||||
# and supply a little time before we start shooting processes
|
||||
# with an M-16.
|
||||
|
||||
# Returns 1 if running, 0 if not, -1 if timed out
|
||||
# Returns 1 if running, 0 if not, -1 if timed out
|
||||
def check():
|
||||
now = datetime.datetime.now()
|
||||
diff = now - starttime
|
||||
if (diff.seconds * 1000 * 1000 + diff.microseconds) < (timeout * 1000):
|
||||
if (diff.seconds * 1000000 + diff.microseconds) < (timeout * 1000): # (1000*1000)
|
||||
if self._job:
|
||||
if (winprocess.QueryInformationJobObject(self._job, 8)['BasicInfo']['ActiveProcesses'] > 0):
|
||||
# Job Object is still containing active processes
|
||||
@@ -314,14 +314,14 @@ class Popen(subprocess.Popen):
|
||||
now = datetime.datetime.now()
|
||||
diff = now - starttime
|
||||
return self.returncode
|
||||
|
||||
|
||||
return self.returncode
|
||||
# We get random maxint errors from subprocesses __del__
|
||||
__del__ = lambda self: None
|
||||
|
||||
def setpgid_preexec_fn():
|
||||
os.setpgid(0, 0)
|
||||
|
||||
|
||||
def runCommand(cmd, **kwargs):
|
||||
if sys.platform != "win32":
|
||||
return Popen(cmd, preexec_fn=setpgid_preexec_fn, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user