summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-05-22 14:40:36 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-05-22 14:40:36 +0000
commitec937861bea0bba0a82073c9de752fd0fdd862f9 (patch)
tree9f1b8dddbe82330d64594366680e50caedc583a7
parent1429df0049ac5134352a35f24ca62ff9aed7d6d3 (diff)
downloadbcfg2-ec937861bea0bba0a82073c9de752fd0fdd862f9.tar.gz
bcfg2-ec937861bea0bba0a82073c9de752fd0fdd862f9.tar.bz2
bcfg2-ec937861bea0bba0a82073c9de752fd0fdd862f9.zip
Fix fd leak caused by our use of the subprocess API
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5251 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Server/Plugins/Svn.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/Server/Plugins/Svn.py b/src/lib/Server/Plugins/Svn.py
index 2cdbecb99..d8fd70ead 100644
--- a/src/lib/Server/Plugins/Svn.py
+++ b/src/lib/Server/Plugins/Svn.py
@@ -34,13 +34,12 @@ class Svn(Bcfg2.Server.Plugin.Plugin,
try:
data = Popen(("env LC_ALL=C svn info %s" %
(self.datastore)), shell=True,
- stdout=PIPE).stdout.readlines()
- revline = [line.split(': ')[1].strip() for line in data \
- if line[:9] == 'Revision:'][-1]
- revision = revline
+ stdout=PIPE).communicate()[0].split('\n')
+ return [line.split(': ')[1] for line in data \
+ if line[:9] == 'Revision:'][-1]
except IndexError:
logger.error("Failed to read svn info; disabling svn support")
logger.error('''Ran command "svn info %s"''' % (self.datastore))
logger.error("Got output: %s" % data)
raise Bcfg2.Server.Plugin.PluginInitError
- return revision
+