summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2007-06-05 18:08:16 +0000
committerluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2007-06-05 18:08:16 +0000
commitb582612ea1260e89fba010f93cad144d2fcbcbed (patch)
tree7fb0fe633a2e02d9dab531eb71020ab77c426dcd
parent09261ac06dfb511c461c2f210b6657154cf59169 (diff)
downloadfacter-b582612ea1260e89fba010f93cad144d2fcbcbed.tar.gz
facter-b582612ea1260e89fba010f93cad144d2fcbcbed.tar.xz
facter-b582612ea1260e89fba010f93cad144d2fcbcbed.zip
Applying patch from Valentin Vidic, fixing open filehandles
git-svn-id: http://reductivelabs.com/svn/facter/trunk@204 1f5c1d6a-bddf-0310-8f58-fc49e503516a
-rw-r--r--lib/facter.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/facter.rb b/lib/facter.rb
index 8731485..e5a22d7 100644
--- a/lib/facter.rb
+++ b/lib/facter.rb
@@ -865,7 +865,9 @@ class Facter
filepath = File.join(dir,file)
if FileTest.file?(filepath)
begin
- value = File.open(filepath).read.chomp.split(/\s+/)[1]
+ File.open(filepath) { |f|
+ value = f.read.chomp.split(/\s+/)[1]
+ }
rescue
value = nil
end