summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt <code@deployable.org>2013-12-04 15:50:46 +0000
committerMatt <code@deployable.org>2013-12-04 15:50:46 +0000
commit13eaf3d1924b56c80c4509398fd7d099a78da0cc (patch)
tree802d697ed5de432c58caf46ef9d4fb66fd3bdda5
parentecbc917ac5496f3138b798332ea66f477c33f8ba (diff)
downloadchef-13eaf3d1924b56c80c4509398fd7d099a78da0cc.tar.gz
CHEF-4850 Close file in Chef::File::Edit after reading contents
-rw-r--r--lib/chef/util/file_edit.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb
index ea0a523baa..3f354124b3 100644
--- a/lib/chef/util/file_edit.rb
+++ b/lib/chef/util/file_edit.rb
@@ -33,7 +33,7 @@ class Chef
@file_edited = false
raise ArgumentError, "File doesn't exist" unless File.exist? @original_pathname
- @contents = File.new(@original_pathname).readlines
+ @contents = File.new(@original_pathname){ |f| f.readlines }
end
#search the file line by line and match each line with the given regex