[FIX] test_reports.py: use communicate() to avoid creating zombie processes
authorChristophe Simonis <chs@openerp.com>
Fri, 30 Nov 2012 15:29:37 +0000 (16:29 +0100)
committerChristophe Simonis <chs@openerp.com>
Fri, 30 Nov 2012 15:29:37 +0000 (16:29 +0100)
bzr revid: chs@openerp.com-20121130152937-xcgs9bxrw7vyewex

openerp/tools/test_reports.py

index 40e0ae2..9ec4dab 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
@@ -73,8 +73,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:
             _logger.debug("Unable to parse PDF report: install pdftotext to perform automated tests.")