Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't launch irb in ruby-2.0.0-p647 because irb parses ARGV #197

Closed
josephks opened this issue Dec 17, 2015 · 5 comments
Closed

Can't launch irb in ruby-2.0.0-p647 because irb parses ARGV #197

josephks opened this issue Dec 17, 2015 · 5 comments

Comments

@josephks
Copy link
Contributor

When I try to invoke irb from within byebug inside my cucumber scenario I can't launch irb because irb tries to parse ARGV which contains cucumber's command line options. This wasn't a problem for me in ruby 1.9.3 with debugger.

Modifying the execute method in lib/byebug/commands/irb.rb like this solves my problem:

    def execute
      unless processor.interface.is_a?(LocalInterface)
        return errmsg(pr('base.errors.only_local'))
      end
      saved_argv = ARGV.dup
      ARGV.clear
      IRB.start(__FILE__)
      ARGV.concat(saved_argv)
    end
@deivid-rodriguez
Copy link
Owner

Could you post some steps to reproduce this?

@josephks
Copy link
Contributor Author

  • Put debugger in your code
  • Run cucumber -b -r features
  • When you enter the debugger type irb
  • Watch irb blow up because it can't parse "-b -r features'

@deivid-rodriguez
Copy link
Owner

Can you post a sample app? I don't want to deal with installing and setting up cucumber. You can also create a PR with a test case.

josephks added a commit to josephks/bug_demo that referenced this issue Feb 1, 2016
@josephks
Copy link
Contributor Author

josephks commented Feb 1, 2016

See https://github.com/josephks/bug_demo

14:29@jshraibman ~/work/bug_demo/demo_app master $ bundle exec cucumber -b -r features features/byebug197.feature
Feature: Running the debugger


[1, 6] in /Users/jshraibman/work/bug_demo/demo_app/features/step_definitions/steps.rb
   1: Given /^I run the debugger$/ do
   2:   require 'byebug'
   3:   # Now type 'irb'
   4:   debugger
=> 5:   nil
   6: end
(byebug) ARGV
["-b", "-r", "features", "features/byebug197.feature"]
(byebug) irb
*** Unrecognized switch: -b

@deivid-rodriguez
Copy link
Owner

Thanks @josephks, I think you patch makes perfect sense. Could you create a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants