summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chef/lib/chef/provider/file.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/chef/lib/chef/provider/file.rb b/chef/lib/chef/provider/file.rb
index ef9e424b04..0fa4894e10 100644
--- a/chef/lib/chef/provider/file.rb
+++ b/chef/lib/chef/provider/file.rb
@@ -58,7 +58,9 @@ class Chef
def is_binary?(path)
::File.open(path) do |file|
- file.read(Chef::Config[:diff_filesize_threshold]) !~ /^[[:print:]]*$/
+ buff = file.read(Chef::Config[:diff_filesize_threshold])
+ buff = "" if buff.nil?
+ return buff !~ /^[[:print:]]*$/
end
end
@@ -84,9 +86,8 @@ class Chef
end
# MacOSX(BSD?) diff will *sometimes* happily spit out nasty binary diffs
- if is_binary?(target_path) || is_binary?(temp_path)
- return [ "(binary files, diff output suppressed)" ]
- end
+ return [ "(current file is binary, diff output suppressed)"] if is_binary?(target_path)
+ return [ "(new content is binary, diff output suppressed)"] if is_binary?(temp_path)
begin
# -u: Unified diff format