Skip to content
Browse files

Bug 920028.

Notice that we override Commander::Command#parse_options_and_call_procs
  - in particular, we add '--help' as a valid command option when '--h'
    is passed.
  - note that '--h' exists in @args for the present RHC::CommandRunner,
    but it is not removed from @args in #run!.
  - #run! calls Command#run, which ends up calling
    Command#parse_options_and_call_procs, which adds '--help' again,
    since '--h' was not removed from @args, and thus passed back to
  - Infinite recursion ensues.
  - So, we need to defend ourselves by removing all potential matches
    for the command option '--help'.
  • Loading branch information...
1 parent 13477fb commit 4c38e90ae893d60b59d55e0ea456bb6ecaeef7ae @BanzaiMan BanzaiMan committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/rhc/command_runner.rb
5 lib/rhc/command_runner.rb
@@ -37,7 +37,10 @@ def run!
#trap('INT') { program(:int_block).call } if program(:int_block)
global_option('-h', '--help', 'Help on any command', :hide => true) do
- args = @args - %w[-h --help]
+ # we need to remove '--h', '--he', '--hel' as well in order to avoid
+ # infinite recursion.
+ # See for a detailed explanation
+ args = @args - %w[-h --h --he --hel --help]

0 comments on commit 4c38e90

Please sign in to comment.
Something went wrong with that request. Please try again.