Sha256: c7f03d0e7559fa79f89d5d35529d3a64e50a612f33f2e4df18e5a5e9cc89cec2
Contents?: true
Size: 449 Bytes
Versions: 3
Compression:
Stored size: 449 Bytes
Contents
# frozen_string_literal: true module Runger::Utils # Cross-platform solution # taken from https://stackoverflow.com/a/5471032 def self.which(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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
runger_config-5.2.0 | lib/runger/utils/which.rb |
runger_config-5.1.0 | lib/runger/utils/which.rb |
runger_config-5.0.0 | lib/runger/utils/which.rb |