Author: gstein
Date: Sun May 12 04:22:28 2024
New Revision: 1917679
URL: http://svn.apache.org/viewvc?rev=1917679&view=rev
Log:
Fix bug: Popen objects do not have .write()
Using .communicate() fixes this bug, and simplifies the code.
* tools/hook-scripts/mailer/mailer.py:
(PipeOutput.deliver): use Popen.communicate() instead of all the
other blather. Add a comment to explain operation.
Modified:
subversion/trunk/tools/hook-scripts/mailer/mailer.py
Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1917679&r1=1917678&r2=1917679&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Sun May 12 04:22:28
2024
@@ -432,15 +432,11 @@ class PipeOutput(MailedOutput):
cmd = self.cmd + [ '-f', self.from_addr ] + self.to_addrs
# construct the pipe for talking to the mailer
- self.pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
- close_fds=sys.platform != "win32")
- self.pipe.write(prefix + body)
+ pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
+ close_fds=sys.platform != "win32")
- # signal that we're done sending content
- self.pipe.stdin.close()
-
- # wait to avoid zombies
- self.pipe.wait()
+ # Send the content to the mailer, and wait for completion.
+ pipe.communicate(prefix + body)
class Messenger: