Sha256: 4125a416ef0fd2824b6edf599d12214fd318421a300f9ebe9207f848c30a5260

Contents?: true

Size: 687 Bytes

Versions: 3

Compression:

Stored size: 687 Bytes

Contents

module Byebug
  module Helpers
    #
    # Utilities for interaction with executables
    #
    module BinHelper
      #
      # Cross-platform way of finding an executable in the $PATH.
      # Borrowed from: http://stackoverflow.com/questions/2108727
      #
      def which(cmd)
        return File.expand_path(cmd) if File.exist?(cmd)

        exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
        ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
          exts.each do |ext|
            exe = File.join(path, "#{cmd}#{ext}")
            return exe if File.executable?(exe) && !File.directory?(exe)
          end
        end

        nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/byebug-9.1.0/lib/byebug/helpers/bin.rb
tdiary-5.0.6 vendor/bundle/gems/byebug-9.1.0/lib/byebug/helpers/bin.rb
byebug-9.1.0 lib/byebug/helpers/bin.rb