Browse Source

update shell neuron to keep output and returned code in a variable. will be used by unit tests

nico 8 years ago
parent
commit
96836ef529
1 changed files with 4 additions and 2 deletions
  1. 4 2
      neurons/shell/shell.py

+ 4 - 2
neurons/shell/shell.py

@@ -46,9 +46,11 @@ class Shell(NeuronModule):
             if not self.async:
                 p = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
                 (output, err) = p.communicate()
+                self.output = output
+                self.returncode = p.returncode
                 message = {
-                    "output": output,
-                    "returncode": p.returncode
+                    "output": self.output,
+                    "returncode": self.returncode
                 }
                 self.say(message)