diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2013-10-22 12:36:51 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2013-10-23 17:15:10 -0700 |
commit | 60f0b9406645a8b0b3faeb60da1d0a0caf3c570b (patch) | |
tree | a217b540a7aceccb98ded77f8e09dbfa90edc910 /lib/chef/knife/core/node_editor.rb | |
parent | 632b134e5bebe06acb91e03867eb453f05fe9c1b (diff) | |
download | chef-60f0b9406645a8b0b3faeb60da1d0a0caf3c570b.tar.gz |
Use Tempfile.open to take a block
- Tempfile.new should either take a block or raise if it gets one,
silently ignoring the block is poor form.
Diffstat (limited to 'lib/chef/knife/core/node_editor.rb')
-rw-r--r-- | lib/chef/knife/core/node_editor.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/chef/knife/core/node_editor.rb b/lib/chef/knife/core/node_editor.rb index 2fe090d114..454af77690 100644 --- a/lib/chef/knife/core/node_editor.rb +++ b/lib/chef/knife/core/node_editor.rb @@ -110,7 +110,8 @@ class Chef end def tempfile_for(data) - Tempfile.new([ 'knife-edit-', '.json' ]) do |file| + Tempfile.open([ 'knife-edit-', '.json' ]) do |file| + file.sync = true file.puts data file.close |