From 38252a40ec853048cba31c93bad0f168532d92c0 Mon Sep 17 00:00:00 2001 From: Joel Maher Date: Thu, 24 Feb 2011 14:45:39 -0500 Subject: [PATCH] Bug 636451 - devicemanager should have the ability to terminate when it can't launch a second process. r=mcote, a=NPOTB --- build/mobile/devicemanager.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build/mobile/devicemanager.py b/build/mobile/devicemanager.py index ab15fced261..40c144f7a10 100644 --- a/build/mobile/devicemanager.py +++ b/build/mobile/devicemanager.py @@ -280,6 +280,9 @@ class DeviceManager: # success: True # failure: False def pushFile(self, localname, destname): + if (os.name == "nt"): + destname = destname.replace('\\', '/') + if (self.debug >= 3): print "in push file with: " + localname + ", and: " + destname if (self.validateFile(destname, localname) == True): if (self.debug >= 3): print "files are validated" @@ -486,7 +489,7 @@ class DeviceManager: # returns: # success: pid # failure: None - def fireProcess(self, appname): + def fireProcess(self, appname, failIfRunning=False): if (not appname): if (self.debug >= 1): print "WARNING: fireProcess called with no command to run" return None @@ -495,6 +498,8 @@ class DeviceManager: if (self.processExist(appname) != None): print "WARNING: process %s appears to be running already\n" % appname + if (failIfRunning): + return None try: data = self.verifySendCMD(['exec ' + appname]) @@ -517,7 +522,7 @@ class DeviceManager: # returns: # success: output filename # failure: None - def launchProcess(self, cmd, outputFile = "process.txt", cwd = '', env = ''): + def launchProcess(self, cmd, outputFile = "process.txt", cwd = '', env = '', failIfRunning=False): if not cmd: if (self.debug >= 1): print "WARNING: launchProcess called without command to run" return None @@ -533,7 +538,7 @@ class DeviceManager: # Prepend our env to the command cmdline = '%s %s' % (self.formatEnvString(env), cmdline) - if self.fireProcess(cmdline) is None: + if self.fireProcess(cmdline, failIfRunning) is None: return None return outputFile @@ -1081,7 +1086,7 @@ class DeviceManager: proclist.append(l.split('\t')) result['process'] = proclist - print "results: " + str(result) + if (self.debug >= 3): print "results: " + str(result) return result """ @@ -1224,7 +1229,6 @@ class DeviceManager: return '' retVal = '"%s"' % ','.join(map(lambda x: '%s=%s' % (x[0], x[1]), env.iteritems())) - print "got retval: '%s'" % retVal if (retVal == '""'): return ''