aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-29 09:09:25 +0000
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-10-29 09:09:25 +0000
commit70b53484f6ed9f68dce39547677d841d121bb590 (patch)
tree19f311f697d9c7039126b4d310affd5c72abc39b /lib/python
parent1b01c9c3c05fdd42327406161bd5c51e05fbca19 (diff)
downloadenigma2-70b53484f6ed9f68dce39547677d841d121bb590.tar.gz
enigma2-70b53484f6ed9f68dce39547677d841d121bb590.zip
add eBatch function for running system commands sequentially
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Console.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/python/Components/Console.py b/lib/python/Components/Console.py
index c451eba7..b0348240 100644
--- a/lib/python/Components/Console.py
+++ b/lib/python/Components/Console.py
@@ -25,6 +25,21 @@ class Console(object):
if retval:
self.finishedCB(name, retval)
+ def eBatch(self, cmds, callback, debug=False):
+ self.debug = debug
+ cmd = cmds.pop(0)
+ self.ePopen(cmd, self.eBatchCB, [cmds, callback, cmd])
+
+ def eBatchCB(self, data, retval, extra_args):
+ (cmds, callback, lastcmd) = extra_args
+ if self.debug:
+ print '[eBatch] cmd="%s", retval=%s, cmds left=%d, data:\n%s' % (lastcmd, retval, len(cmds), data)
+ if len(cmds):
+ cmd = cmds.pop(0)
+ self.ePopen(cmd, self.eBatchCB, [cmds, callback, cmd])
+ else:
+ callback()
+
def dataAvailCB(self, name, data):
self.appResults[name] += data