aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMax Howell2009-09-23 16:44:10 +0100
committerMax Howell2009-09-24 18:26:24 +0100
commit44a1fa418e4251486ac811d1f8a2db99847f69b5 (patch)
tree12c9539f4d7f117820c412a9e006fe686c13e12e /Library/Homebrew/utils.rb
parent034fc40ae122f0d99ea0793264ed74c986866327 (diff)
downloadbrew-44a1fa418e4251486ac811d1f8a2db99847f69b5.tar.bz2
Use full paths to all system utilities
Otherwise you run the risk of not running the exact version / make of the utility you planned. Fixes Homebrew/homebrew#48 Really we need to do this formula too, so I guess a make and cmake function are on the way…
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 3efeb99a6..208a01e8e 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -23,7 +23,7 @@
# args are additional inputs to puts until a nil arg is encountered
def ohai title, *sput
- title = title[0, `tput cols`.strip.to_i-4] unless ARGV.verbose?
+ title = title[0, `/usr/bin/tput cols`.strip.to_i-4] unless ARGV.verbose?
puts "\033[0;34m==>\033[0;0;1m #{title}\033[0;0m"
puts *sput unless sput.empty?
end
@@ -59,12 +59,12 @@ end
# Kernel.system but with exceptions
def safe_system cmd, *args
puts "#{cmd} #{args*' '}" if ARGV.verbose?
- exec_success=Kernel.system cmd, *args
+ exec_success = Kernel.system cmd, *args
# some tools, eg. tar seem to confuse ruby and it doesn't propogate the
# CTRL-C interrupt to us too, so execution continues, but the exit code os
# still 2 so we raise our own interrupt
raise Interrupt, cmd if $?.termsig == 2
- unless exec_success and $?.success?
+ unless exec_success
puts "Exit code: #{$?}"
raise ExecutionError.new(cmd, args)
end
@@ -75,23 +75,23 @@ def curl *args
end
def puts_columns items, cols = 4
- items = items.join("\n") if items.is_a?(Array)
- items.concat("\n") unless items.empty?
if $stdout.tty?
- width=`stty size`.chomp.split(" ").last
- IO.popen("pr -#{cols} -t", "w"){|io| io.write(items) }
+ items = items.join("\n") if items.is_a?(Array)
+ items.concat("\n") unless items.empty?
+ width=`/bin/stty size`.chomp.split(" ").last
+ IO.popen("/usr/bin/pr -#{cols} -t", "w"){|io| io.write(items) }
else
- items.each { |i| $stdout.write(i) }
+ puts *items
end
end
def exec_editor *args
editor=ENV['EDITOR']
if editor.nil?
- if system "which -s mate" and $?.success?
+ if system "/usr/bin/which -s mate"
editor='mate'
else
- editor='vim'
+ editor='/usr/bin/vim'
end
end
# we split the editor because especially on mac "mate -w" is common
@@ -103,9 +103,9 @@ end
# provide an absolute path to a command or this function will search the PATH
def arch_for_command cmd
archs = []
- cmd = `which #{cmd}` if not Pathname.new(cmd).absolute?
+ cmd = `/usr/bin/which #{cmd}` if not Pathname.new(cmd).absolute?
- IO.popen("file #{cmd}").readlines.each do |line|
+ IO.popen("/usr/bin/file #{cmd}").readlines.each do |line|
case line
when /Mach-O executable ppc/
archs << :ppc7400