Commit 68cf9524 authored by Łukasz Nowak's avatar Łukasz Nowak

- simplify subprocess communication and avoid leaving zombies (thanks to jm)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33195 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2d8b10d7
...@@ -20,8 +20,8 @@ print sys.version_info[:2] ...@@ -20,8 +20,8 @@ print sys.version_info[:2]
f.close() f.close()
f_stat = os.stat(name) f_stat = os.stat(name)
os.chmod(name, f_stat.st_mode | stat.S_IXUSR) os.chmod(name, f_stat.st_mode | stat.S_IXUSR)
result = ''.join(subprocess.Popen([name], stdout=subprocess.PIPE)\ result = subprocess.Popen([name], stdout=subprocess.PIPE)\
.stdout.readlines()).strip() .communicate()[0].strip()
self.assertEqual('(2, 4)', result) self.assertEqual('(2, 4)', result)
finally: finally:
os.unlink(name) os.unlink(name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment