mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +01:00
Made sure the fd gets closed in Http.kernel.
This commit is contained in:
parent
aaef8cdf70
commit
1aaf611158
@ -312,14 +312,16 @@ class Http(callbacks.Privmsg):
|
|||||||
|
|
||||||
Returns information about the current version of the Linux kernel.
|
Returns information about the current version of the Linux kernel.
|
||||||
"""
|
"""
|
||||||
fd = webutils.getUrlFd('http://www.kernel.org/kdist/finger_banner')
|
try:
|
||||||
for line in fd:
|
fd = webutils.getUrlFd('http://www.kernel.org/kdist/finger_banner')
|
||||||
(name, version) = line.split(':')
|
for line in fd:
|
||||||
if 'latest stable' in name:
|
(name, version) = line.split(':')
|
||||||
stable = version.strip()
|
if 'latest stable' in name:
|
||||||
elif 'latest beta' in name:
|
stable = version.strip()
|
||||||
beta = version.strip()
|
elif 'latest beta' in name:
|
||||||
fd.close()
|
beta = version.strip()
|
||||||
|
finally:
|
||||||
|
fd.close()
|
||||||
irc.reply(msg, 'The latest stable kernel is %s; ' \
|
irc.reply(msg, 'The latest stable kernel is %s; ' \
|
||||||
'the latest beta kernel is %s.' % (stable, beta))
|
'the latest beta kernel is %s.' % (stable, beta))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user