[FIX] test_reports.py: use communicate() to avoid creating zombie processes (manual...
authorChristophe Simonis <chs@openerp.com>
Mon, 3 Dec 2012 12:45:04 +0000 (13:45 +0100)
committerChristophe Simonis <chs@openerp.com>
Mon, 3 Dec 2012 12:45:04 +0000 (13:45 +0100)
bzr revid: chs@openerp.com-20121203124504-317o3ka8a40pvrdt

bin/tools/test_reports.py

index 6e4b08e..397b7e8 100644 (file)
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
-#    Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
+#    Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
 #
 #    This program is free software: you can redistribute it and/or modify
 #    it under the terms of the GNU Affero General Public License as
@@ -75,8 +75,9 @@ def try_report(cr, uid, rname, ids, data=None, context=None, our_module=None):
             os.write(fd, res_data)
             os.close(fd)
 
-            fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', rfname, '-'], shell=False, stdout=PIPE).stdout
-            res_text = tools.ustr(fp.read())
+            proc = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', rfname, '-'], shell=False, stdout=PIPE)
+            stdout, stderr = proc.communicate()
+            res_text = tools.ustr(stdout)
             os.unlink(rfname)
         except Exception:
             log.debug("Unable to parse PDF report: install pdftotext to perform automated tests.")