Skip to content

Commit

Permalink
Remove windows specific exec. Open2.capture3 should work on all
Browse files Browse the repository at this point in the history
platforms.
  • Loading branch information
Sam Goldstein committed Jun 10, 2022
1 parent ff2103d commit 478f392
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/diffy/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ def diff
[string1, string2]
end

if WINDOWS
# don't use open3 on windows
cmd = sprintf '"%s" %s %s', diff_bin, diff_options.join(' '), @paths.map { |s| %("#{s}") }.join(' ')
diff = `#{cmd}`
else
diff = Open3.popen3(diff_bin, *(diff_options + @paths)) { |i, o, e| o.read }
end
diff, stderr, process_status = Open3.capture3(diff_bin, *(diff_options + @paths))
diff.force_encoding('ASCII-8BIT') if diff.respond_to?(:valid_encoding?) && !diff.valid_encoding?
if diff =~ /\A\s*\Z/ && !options[:allow_empty_diff]
diff = case options[:source]
Expand Down

0 comments on commit 478f392

Please # to comment.