Skip to content

NoMethodError when invoking rails command without arguments (undefined method `start_with?' for nil:NilClass) #666

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

Closed
mernen opened this issue Jan 2, 2022 · 0 comments · Fixed by #667

Comments

@mernen
Copy link
Contributor

mernen commented Jan 2, 2022

With Spring 4.0, running rails without any arguments causes a NoMethodError.

This is caused by b85f41be, since command_name will be nil in that case. I believe a null check is all that's needed.

Steps for reproduction

On a terminal, run the rails command in a Rails project that has Spring 4.0.

Example output

$ rails
Traceback (most recent call last):
    12: from bin/rails:2:in `<main>'
    11: from bin/rails:2:in `load'
    10: from /usr/src/testapp/bin/spring:7:in `<top (required)>'
     9: from /usr/src/testapp/bin/spring:7:in `tap'
     8: from /usr/src/testapp/bin/spring:10:in `block in <top (required)>'
     7: from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
     6: from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
     5: from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `<top (required)>'
     4: from /usr/local/bundle/gems/spring-4.0.0/lib/spring/binstub.rb:11:in `load'
     3: from /usr/local/bundle/gems/spring-4.0.0/bin/spring:49:in `<top (required)>'
     2: from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client.rb:30:in `run'
     1: from /usr/local/bundle/gems/spring-4.0.0/lib/spring/client/command.rb:7:in `call'
/usr/local/bundle/gems/spring-4.0.0/lib/spring/client/rails.rb:25:in `call': undefined method `start_with?' for nil:NilClass (NoMethodError)
mernen added a commit to mernen/spring that referenced this issue Jan 2, 2022
mernen added a commit to mernen/spring that referenced this issue Jan 2, 2022
mernen added a commit to mernen/completion-ruby that referenced this issue Jan 2, 2022
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

Successfully merging a pull request may close this issue.

1 participant