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