From 6ae9f02e31e9ca89ab383ed799b1150a95bfb854 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Tue, 31 Mar 2009 15:09:50 -0400 Subject: [PATCH] In TracZephyrPlugin: use subprocess instead of os.popen. --- TracZephyrPlugin/ZephyrPlugin.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/TracZephyrPlugin/ZephyrPlugin.py b/TracZephyrPlugin/ZephyrPlugin.py index 688749a..317cb0d 100644 --- a/TracZephyrPlugin/ZephyrPlugin.py +++ b/TracZephyrPlugin/ZephyrPlugin.py @@ -1,6 +1,6 @@ from trac.core import * from trac.ticket import ITicketChangeListener -import os +import subprocess import textwrap class ZephyrPlugin(Component): @@ -10,9 +10,13 @@ class ZephyrPlugin(Component): zclass = self.config.get('ZephyrPlugin', 'class') if zclass == '': return - pipe = os.popen('zwrite -q -l -d -c %s -i trac-#%s' % (zclass, id), 'w') - pipe.write("\n".join(textwrap.wrap(message)).encode('utf-8', 'replace')) - pipe.close() + p = subprocess.Popen(['zwrite', '-q', '-l', '-d', + '-c', zclass, + '-i', 'trac-#%s' % id], + stdin=subprocess.PIPE) + p.stdin.write("\n".join(textwrap.wrap(message)).encode('utf-8', 'replace')) + p.stdin.close() + p.wait() def ticket_created(self, ticket): message = "%s filed a new ticket:\n%s\n\n%s" % (ticket['reporter'], ticket['summary'], ticket['description'][:255]) -- 2.45.0