diff options
author | Rex Lee <limingjiang@huawei.com> | 2017-01-10 08:48:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-01-10 08:48:55 +0000 |
commit | 45db0fdabb4585b96756a390650181a3c46facf7 (patch) | |
tree | 924bb6c99902df5913619b614e2fc75a56f20ac5 /yardstick | |
parent | 57011bd0769f54a98b90d489df0f38751ca76c0e (diff) | |
parent | aad4b7d74f7bfd272fd7ab601a61e7f2c4d0e64c (diff) |
Merge "subprocess.call para stdout=PIPE is risky"
Diffstat (limited to 'yardstick')
-rw-r--r-- | yardstick/benchmark/scenarios/parser/parser.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/yardstick/benchmark/scenarios/parser/parser.py b/yardstick/benchmark/scenarios/parser/parser.py index 006258d05..bb16e7c89 100644 --- a/yardstick/benchmark/scenarios/parser/parser.py +++ b/yardstick/benchmark/scenarios/parser/parser.py @@ -58,10 +58,12 @@ class Parser(base.Scenario): cmd1 = "%s %s %s" % (self.parser_script, yangfile, toscafile) cmd2 = "chmod 777 %s" % (self.parser_script) subprocess.call(cmd2, shell=True) - output = subprocess.call(cmd1, shell=True, stdout=subprocess.PIPE) + p = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + p.communicate() print "yangtotosca finished" - result['yangtotosca'] = "success" if output == 0 else "fail" + result['yangtotosca'] = "success" if p.returncode == 0 else "fail" def teardown(self): ''' for scenario teardown remove parser and pyang ''' |