Sha256: 9ab0aef9bab70ddbec1f48f27e683f69b54a04944fc0636258037ce9dbd1bbcc
Contents?: true
Size: 487 Bytes
Versions: 1
Compression:
Stored size: 487 Bytes
Contents
# frozen_string_literal: true module Runger module 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
runger_config-4.0.0 | lib/runger/utils/which.rb |