aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2012-11-11 18:07:03 -0600
committerJack Nagel2012-11-11 18:49:32 -0600
commitefcd926d1b0521726f175f306cff807d763808fb (patch)
treedd0e54c1f7f0d7a78cf3125b079c4ab903c36c0d /Library/Homebrew
parent6136c3c5d186d0e7460d8c014d019218fec27d89 (diff)
downloadbrew-efcd926d1b0521726f175f306cff807d763808fb.tar.bz2
Work around Readline clash
Only limited debugging functionality is available to things that involve the Readline formula, but it is better than crashing outright. c.f. Homebrew/homebrew#15776. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/debrew.rb15
-rw-r--r--Library/Homebrew/formula_installer.rb6
2 files changed, 14 insertions, 7 deletions
diff --git a/Library/Homebrew/debrew.rb b/Library/Homebrew/debrew.rb
index eff396909..54f01a234 100644
--- a/Library/Homebrew/debrew.rb
+++ b/Library/Homebrew/debrew.rb
@@ -1,9 +1,10 @@
-require 'irb'
-begin
- require 'continuation' # needed on 1.9
-rescue LoadError
+def can_use_readline?
+ not ENV['HOMEBREW_NO_READLINE']
end
+require 'irb' if can_use_readline?
+require 'continuation' if RUBY_VERSION.to_f >= 1.9
+
class Menu
attr_accessor :prompt
attr_accessor :entries
@@ -75,7 +76,7 @@ module IRB
irb_at_exit
end
end
-end
+end if can_use_readline?
class Exception
attr_accessor :continuation
@@ -92,7 +93,7 @@ def has_debugger?
true
rescue LoadError
false
- end
+ end if can_use_readline?
end
def debrew(exception, formula=nil)
@@ -121,7 +122,7 @@ def debrew(exception, formula=nil)
end
}
end
- end
+ end if can_use_readline?
menu.choice(:shell) do
puts "When you exit this shell, you will return to the menu."
interactive_shell formula
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 65f6d44b3..a5cc1def4 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -73,6 +73,12 @@ class FormulaInstaller
needed_deps = []
needed_reqs = []
+ # HACK: If readline is present in the dependency tree, it will clash
+ # with the stdlib's Readline module when the debugger is loaded
+ if f.recursive_deps.any? { |d| d.name == "readline" } and ARGV.debug?
+ ENV['HOMEBREW_NO_READLINE'] = '1'
+ end
+
ARGV.filter_for_dependencies do
needed_deps = f.recursive_deps.reject{ |d| d.installed? }
needed_reqs = f.recursive_requirements.reject { |r| r.satisfied? }