Made sure to close file descriptors in debfile.

This commit is contained in:
Jeremy Fincher 2003-09-05 06:47:12 +00:00
parent d43b1ea700
commit 28b0fdba97

View File

@ -118,8 +118,9 @@ class Debian(callbacks.Privmsg, PeriodicFileDownloader):
if self.usePythonZegrep:
fd = gzip.open(self.contents)
fd = ifilter(imap(lambda line: r.search(line), fd))
(fd, _) = popen2.popen4(['zegrep', regexp, self.contents])
(r, w) = popen2.popen4(['zegrep', regexp, self.contents])
packages = []
try:
for line in fd:
try:
(filename, package) = line[:-1].split()
@ -134,6 +135,9 @@ class Debian(callbacks.Privmsg, PeriodicFileDownloader):
irc.error(msg, 'More than 40 results returned, ' \
'please be more specific.')
return
finally:
r.close()
w.close()
if len(packages) == 0:
irc.reply(msg, 'I found no packages with that file.')
else: