1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/irb
Aleksandar Ivanov d65d661151 [ruby/irb] Prevent the completion from crashing if rdoc is missing
There are cases where ruby is installed without rdoc and e.g.
lib/irb/cmd/help.rb also handles the LoadError

Here is how to replicate the issue:

```
$ docker run -it alpine:3.13.3 sh

/ # apk add ruby ruby-irb ruby-io-console

/ # irb

irb(main):001:0> Class[TAB][TAB]
```

And you end up with something like:

```
irb(main):001:0> ClassTraceback (most recent call last):
        34: from /usr/bin/irb:23:in `<main>'
        33: from /usr/bin/irb:23:in `load'
        32: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        31: from /usr/lib/ruby/2.7.0/irb.rb:400:in `start'
        30: from /usr/lib/ruby/2.7.0/irb.rb:471:in `run'
        29: from /usr/lib/ruby/2.7.0/irb.rb:471:in `catch'
        28: from /usr/lib/ruby/2.7.0/irb.rb:472:in `block in run'
        27: from /usr/lib/ruby/2.7.0/irb.rb:537:in `eval_input'
        26: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `each_top_level_statement'
        25: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `catch'
        24: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `block in each_top_level_statement'
        23: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `loop'
        22: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:154:in `block (2 levels) in each_top_level_statement'
        21: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:182:in `lex'
        20: from /usr/lib/ruby/2.7.0/irb.rb:518:in `block in eval_input'
        19: from /usr/lib/ruby/2.7.0/irb.rb:704:in `signal_status'
        18: from /usr/lib/ruby/2.7.0/irb.rb:519:in `block (2 levels) in eval_input'
        17: from /usr/lib/ruby/2.7.0/irb/input-method.rb:294:in `gets'
        16: from /usr/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
        15: from /usr/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
        14: from /usr/lib/ruby/2.7.0/reline.rb:175:in `readmultiline'
        13: from /usr/lib/ruby/2.7.0/reline.rb:238:in `inner_readline'
        12: from /usr/lib/ruby/2.7.0/reline.rb:238:in `loop'
        11: from /usr/lib/ruby/2.7.0/reline.rb:239:in `block in inner_readline'
        10: from /usr/lib/ruby/2.7.0/reline.rb:270:in `read_io'
         9: from /usr/lib/ruby/2.7.0/reline.rb:270:in `loop'
         8: from /usr/lib/ruby/2.7.0/reline.rb:311:in `block in read_io'
         7: from /usr/lib/ruby/2.7.0/reline.rb:240:in `block (2 levels) in inner_readline'
         6: from /usr/lib/ruby/2.7.0/reline.rb:240:in `each'
         5: from /usr/lib/ruby/2.7.0/reline.rb:241:in `block (3 levels) in inner_readline'
         4: from /usr/lib/ruby/2.7.0/reline/line_editor.rb:820:in `input_key'
         3: from /usr/lib/ruby/2.7.0/reline/line_editor.rb:608:in `complete'
         2: from /usr/lib/ruby/2.7.0/irb/completion.rb:269:in `block in <module:InputCompletor>'
         1: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- rdoc (LoadError)
```

https://github.com/ruby/irb/commit/a2d299c2ac
2021-03-30 14:27:51 +09:00
..
cmd [ruby/irb] Have some right padding 2021-03-21 16:01:29 +09:00
ext [ruby/irb] Make save-history extension safe for concurrent use 2021-03-06 00:18:32 +09:00
lc [ruby/irb] Update help message for next context-mode of 4 2021-02-27 06:51:12 +09:00
.document [ruby/irb] Exclude useless files from RDoc 2020-02-01 17:03:59 +09:00
color.rb [ruby/irb] handle __ENCODING__ as a keyword as well 2021-01-18 02:12:43 +09:00
color_printer.rb [ruby/irb] Don't call Ruby 2.4+'s String#pretty_print 2021-03-20 20:25:32 +09:00
completion.rb [ruby/irb] Prevent the completion from crashing if rdoc is missing 2021-03-30 14:27:51 +09:00
context.rb [ruby/irb] Drop OMIT_ON_ASSIGNMENT and add :truncate option for ECHO_ON_ASSIGNMENT 2020-09-19 05:13:08 +09:00
easter-egg.rb Revert "Prefer #send over #__send__ when it is clear there is no possible conflict" 2020-11-05 20:54:34 +09:00
extend-command.rb [ruby/irb] Add whereami command 2021-03-21 13:40:21 +09:00
frame.rb
help.rb [ruby/irb] Discard newlines at end of file 2020-08-28 11:05:18 +09:00
init.rb [ruby/irb] Enable to reassign a new block with "measure" command 2021-02-06 21:09:31 +09:00
input-method.rb [ruby/irb] Complete require and require_relative 2021-03-24 15:11:41 +09:00
inspector.rb [ruby/irb] Make IRB::ColorPrinter.pp compatible with PP.pp 2021-01-07 22:43:40 -08:00
irb.gemspec [ruby/irb] Add all lib files automatically 2021-03-20 07:36:21 +09:00
locale.rb Use Reline.encoding_system_needs if exists 2020-01-14 15:40:38 +09:00
magic-file.rb
notifier.rb
output-method.rb
ruby-lex.rb [ruby/irb] Change ripper_lex_without_warning to a class method 2021-03-24 14:39:50 +09:00
ruby_logo.aa [ruby/irb] Discard newlines at end of file 2020-08-28 11:05:18 +09:00
src_encoding.rb
version.rb [ruby/irb] Version 1.3.4 2021-02-25 22:11:48 +09:00
workspace.rb [ruby/irb] Suppress colorize on Windows tests 2021-02-11 20:31:29 +09:00
ws-for-case-2.rb
xmp.rb [ruby/irb] Prefer require_relative to load the files in this library 2020-08-18 14:38:01 +09:00