lib/keystone/os/unix.rb in keystone-0.0.29 vs lib/keystone/os/unix.rb in keystone-0.0.30

- old
+ new

@@ -1,5 +1,6 @@ +# -*- coding: utf-8 -*- module Keystone module Os class Unix < AbstractOs def ip_address ifconfig = `/sbin/ifconfig` @@ -14,12 +15,12 @@ return ips end def bin_or_usrbin(cmd,option="") cmd_option = "#{cmd} #{option}" - begin;return `/bin/#{cmd_option}` if File.exists?("/bin/#{cmd}");rescue;end - begin;return `/usr/bin/#{cmd_option}` if File.exists?("/usr/bin/#{cmd}");rescue;end - begin;return `/sbin/#{cmd_option}` if File.exists?("/sbin/#{cmd}");rescue;end + begin;return `/bin/#{cmd_option}`.chomp if File.exists?("/bin/#{cmd}");rescue;end + begin;return `/usr/bin/#{cmd_option}`.chomp if File.exists?("/usr/bin/#{cmd}");rescue;end + begin;return `/sbin/#{cmd_option}`.chomp if File.exists?("/sbin/#{cmd}");rescue;end begin;return `/usr/sbin/#{cmd_option}`.chomp;rescue;end end def hostname bin_or_usrbin("hostname") \ No newline at end of file