lib/cli/kit/system.rb in cli-kit-3.1.0 vs lib/cli/kit/system.rb in cli-kit-3.3.0

- old
+ new

@@ -189,12 +189,16 @@ # See https://github.com/Shopify/dev/pull/625 for more details. def resolve_path(a, env) # If only one argument was provided, make sure it's interpreted by a shell. return ["true ; " + a[0]] if a.size == 1 return a if a.first.include?('/') - item = env.fetch('PATH', '').split(':').detect do |f| - File.exist?("#{f}/#{a.first}") + + paths = env.fetch('PATH', '').split(':') + item = paths.detect do |f| + command_path = "#{f}/#{a.first}" + File.executable?(command_path) && File.file?(command_path) end + a[0] = "#{item}/#{a.first}" if item a end end end