summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/base.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/base.py b/scripts/base.py
index 5e5161e..324298e 100755
--- a/scripts/base.py
+++ b/scripts/base.py
@@ -73,13 +73,18 @@ class base:
#
# run command and get result as plane text
#--------------------
- def run(self, command):
+ def run2(self, command):
# Ughhhh
# I don't like python external command !!
# (ノ `Д´)ノ go away !!
- return self.chomp(subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).\
- communicate()[0].decode("utf-8"));
+ child = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
+ stdout, stderr = child.communicate()
+
+ return self.chomp(stdout.decode("utf-8")), child.returncode;
+
+ def run(self, command):
+ return self.run2(command)[0]
#--------------------
# run1()