Bug 1084519 - Return full uptime string if unable to parse. r=gbrown

This commit is contained in:
Dave Hunt 2014-10-20 04:44:00 +02:00
parent ede9c7af78
commit 498ac3ed15

View File

@ -504,12 +504,14 @@ class DeviceManagerADB(DeviceManager):
if directive == "os" or directive == "all": if directive == "os" or directive == "all":
ret["os"] = self.shellCheckOutput(["getprop", "ro.build.display.id"]) ret["os"] = self.shellCheckOutput(["getprop", "ro.build.display.id"])
if directive == "uptime" or directive == "all": if directive == "uptime" or directive == "all":
utime = self.shellCheckOutput(["uptime"]) uptime = self.shellCheckOutput(["uptime"])
if (not utime): if not uptime:
raise DMError("error getting uptime") raise DMError("error getting uptime")
m = re.match("up time: ((\d+) days, )*(\d{2}):(\d{2}):(\d{2})", utime) m = re.match("up time: ((\d+) days, )*(\d{2}):(\d{2}):(\d{2})", uptime)
ret["uptime"] = "%d days %d hours %d minutes %d seconds" % tuple( if m:
uptime = "%d days %d hours %d minutes %d seconds" % tuple(
[int(g or 0) for g in m.groups()[1:]]) [int(g or 0) for g in m.groups()[1:]])
ret["uptime"] = uptime
if directive == "process" or directive == "all": if directive == "process" or directive == "all":
ret["process"] = self.shellCheckOutput(["ps"]) ret["process"] = self.shellCheckOutput(["ps"])
if directive == "systime" or directive == "all": if directive == "systime" or directive == "all":