X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/70b53484f6ed9f68dce39547677d841d121bb590..b3135c06dd527e0ed65b6ffa921f830132f7d8b9:/lib/python/Components/Console.py diff --git a/lib/python/Components/Console.py b/lib/python/Components/Console.py index b0348240..136d10d0 100644 --- a/lib/python/Components/Console.py +++ b/lib/python/Components/Console.py @@ -8,7 +8,7 @@ class Console(object): self.callbacks = {} self.extra_args = {} - def ePopen(self, cmd, callback, extra_args=[]): + def ePopen(self, cmd, callback=None, extra_args=[]): name = cmd i = 0 while self.appContainers.has_key(name): @@ -25,20 +25,20 @@ class Console(object): if retval: self.finishedCB(name, retval) - def eBatch(self, cmds, callback, debug=False): + def eBatch(self, cmds, callback, extra_args=[], debug=False): self.debug = debug cmd = cmds.pop(0) - self.ePopen(cmd, self.eBatchCB, [cmds, callback, cmd]) + self.ePopen(cmd, self.eBatchCB, [cmds, callback, extra_args]) - def eBatchCB(self, data, retval, extra_args): - (cmds, callback, lastcmd) = extra_args + def eBatchCB(self, data, retval, _extra_args): + (cmds, callback, extra_args) = _extra_args if self.debug: - print '[eBatch] cmd="%s", retval=%s, cmds left=%d, data:\n%s' % (lastcmd, retval, len(cmds), data) + print '[eBatch] retval=%s, cmds left=%d, data:\n%s' % (retval, len(cmds), data) if len(cmds): cmd = cmds.pop(0) - self.ePopen(cmd, self.eBatchCB, [cmds, callback, cmd]) + self.ePopen(cmd, self.eBatchCB, [cmds, callback, extra_args]) else: - callback() + callback(extra_args) def dataAvailCB(self, name, data): self.appResults[name] += data @@ -50,5 +50,6 @@ class Console(object): extra_args = self.extra_args[name] del self.appContainers[name] del self.extra_args[name] - self.callbacks[name](data,retval,extra_args) + if self.callbacks[name]: + self.callbacks[name](data,retval,extra_args) del self.callbacks[name]