Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
De-duplicates cocaine command line path per run
Browse files Browse the repository at this point in the history
Adds failing spec to command line dup check

[fixes #1670]
[fixes #2169]
  • Loading branch information
christophed authored and tute committed Apr 12, 2016
1 parent 4ef27eb commit f7aa320
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/paperclip/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def interpolates key, &block
#
def run(cmd, arguments = "", interpolation_values = {}, local_options = {})
command_path = options[:command_path]
Cocaine::CommandLine.path = [Cocaine::CommandLine.path, command_path].flatten.compact.uniq
cocaine_path_array = Cocaine::CommandLine.path.try(:split, Cocaine::OS.path_separator)
Cocaine::CommandLine.path = [cocaine_path_array, command_path].flatten.compact.uniq
if logging? && (options[:log_command] || local_options[:log_command])
local_options = local_options.merge(:logger => logger)
end
Expand Down
4 changes: 3 additions & 1 deletion spec/paperclip/paperclip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
Paperclip.options[:command_path] = "/opt/my_app/bin"
Paperclip.run("convert", "stuff")
Paperclip.run("convert", "more_stuff")
assert_equal 1, [Cocaine::CommandLine.path].flatten.size

cmd_path = Paperclip.options[:command_path]
assert_equal 1, Cocaine::CommandLine.path.scan(cmd_path).count
end
end

Expand Down

0 comments on commit f7aa320

Please sign in to comment.