lib/cliver/detector.rb in cliver-0.1.1 vs lib/cliver/detector.rb in cliver-0.1.2

- old
+ new

@@ -1,7 +1,7 @@ # encoding: utf-8 -require 'open3' +require 'shellwords' module Cliver # The interface for Cliver::Detector classes. # @see Cliver::Detector::Default for reference implementation module Detector @@ -26,10 +26,12 @@ end # @param executable [String] - the path to the executable to test # @return [String] - should be Gem::Version-parsable. def detect_version(executable) - output, _ = Open3.capture2e(*version_command(executable)) + command_parts = version_command(executable) + escaped_command_parts = command_parts.map(&Shellwords.method(:escape)) + output = `#{escaped_command_parts.join(' ')} 2>&1` ver = output.scan(version_pattern) ver && ver.first end # This is the interface that any detector must have.