fix docs code discrepancy and error reporting with non empty format strings

This commit is contained in:
Arvedui 2015-09-06 14:01:42 +02:00
parent 2a432c6bb2
commit 05a9cd551e

View File

@ -24,7 +24,7 @@ class Shell(IntervalModule):
) )
required = ("command",) required = ("command",)
format = "{command}" format = "{output}"
def run(self): def run(self):
retvalue, out, stderr = run_through_shell(self.command, enable_shell=True) retvalue, out, stderr = run_through_shell(self.command, enable_shell=True)
@ -37,9 +37,7 @@ class Shell(IntervalModule):
elif stderr: elif stderr:
out = stderr out = stderr
out = self.format.format(command=out)
self.output = { self.output = {
"full_text": out if out else "Command `%s` returned %d" % (self.command, retvalue), "full_text": self.format.format(output=out) if out else "Command `%s` returned %d" % (self.command, retvalue),
"color": self.color if retvalue == 0 else self.error_color "color": self.color if retvalue == 0 else self.error_color
} }