diff options
| author | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-12-08 13:35:55 +0100 |
|---|---|---|
| committer | Fraxinas <andreas.frisch@multimedia-labs.de> | 2008-12-08 13:35:55 +0100 |
| commit | d53eb38c31fb300d39c98fef81af99a40819246f (patch) | |
| tree | a9639626ada76e56d3bf82060f10354ba587f663 | |
| parent | dbdd7b433aa9c2da4fdd52b260c939e6041c96b2 (diff) | |
| download | enigma2-d53eb38c31fb300d39c98fef81af99a40819246f.tar.gz enigma2-d53eb38c31fb300d39c98fef81af99a40819246f.zip | |
allow using complex shell commandlines (including | etc.) for job tasks (handle with care, no tool exist precondition checking!)
| -rw-r--r-- | lib/python/Components/Task.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/python/Components/Task.py b/lib/python/Components/Task.py index 9a768425..04e5c938 100644 --- a/lib/python/Components/Task.py +++ b/lib/python/Components/Task.py @@ -127,6 +127,7 @@ class Task(object): self.cmd = None self.cwd = "/tmp" self.args = [ ] + self.cmdline = None self.task_progress_changed = None self.output_line = "" job.addTask(self) @@ -141,6 +142,9 @@ class Task(object): self.global_preconditions.append(ToolExistsPrecondition()) self.postconditions.append(ReturncodePostcondition()) + def setCmdline(self, cmdline): + self.cmdline = cmdline + def checkPreconditions(self, immediate = False): not_met = [ ] if immediate: @@ -166,13 +170,15 @@ class Task(object): self.container.stdoutAvail.append(self.processStdout) self.container.stderrAvail.append(self.processStderr) - assert self.cmd is not None - assert len(self.args) >= 1 - if self.cwd is not None: self.container.setCWD(self.cwd) - print "execute:", self.container.execute(self.cmd, *self.args), self.cmd, self.args + if not self.cmd and self.cmdline: + print "execute:", self.container.execute(self.cmdline), self.cmdline + else: + assert self.cmd is not None + assert len(self.args) >= 1 + print "execute:", self.container.execute(self.cmd, *self.args), ' '.join(self.args) if self.initial_input: self.writeInput(self.initial_input) |
