From b582612ea1260e89fba010f93cad144d2fcbcbed Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 5 Jun 2007 18:08:16 +0000 Subject: Applying patch from Valentin Vidic, fixing open filehandles git-svn-id: http://reductivelabs.com/svn/facter/trunk@204 1f5c1d6a-bddf-0310-8f58-fc49e503516a --- lib/facter.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit