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

initconfig => error: can't modify frozen String #265

Closed
mickael-palma-argus opened this issue Jul 25, 2017 · 3 comments
Closed

initconfig => error: can't modify frozen String #265

mickael-palma-argus opened this issue Jul 25, 2017 · 3 comments

Comments

@mickael-palma-argus
Copy link
Contributor

Hi,

I have # frozen_string_literal: true at the beginning of my bin file.
When I run bundle exec bin/app initconfig I get this error:

error: can't modify frozen String

I have to use # frozen_string_literal: false to succeed the command.

How I can I make it work with # frozen_string_literal: true.

Thx for your help.

@davetron5000
Copy link
Owner

Can you run your app with GLI_DEBUG=true so that it generates a stack trace and we can see where that error is coming from?

GLI_DEBUG=true my_app whatever -foo=bar # for example

@mickael-palma
Copy link

imac:etl4api mickael$ GLI_DEBUG=true bundle exec bin/etl4api initconfig
error: can't modify frozen String
bundler: failed to load command: bin/etl4api (bin/etl4api)
RuntimeError: can't modify frozen String
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/commands/initconfig.rb:41:in `force_encoding'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/commands/initconfig.rb:41:in `block in create_config'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/commands/initconfig.rb:38:in `map'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/commands/initconfig.rb:38:in `create_config'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/commands/initconfig.rb:27:in `block in initialize'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/command_support.rb:131:in `execute'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/app_support.rb:296:in `block in call_command'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/app_support.rb:309:in `call_command'
  /Users/mickael/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gli-2.16.0/lib/gli/app_support.rb:83:in `run'
  bin/etl4api:176:in `<top (required)>'

If you wonder line 176 has : exit run(ARGV)

@davetron5000
Copy link
Owner

It's this line: https://github.com/davetron5000/gli/blob/gli-2/lib/gli/commands/initconfig.rb#L41

That line might not be needed any longer—I think it was added for support of an old Ruby. If you want to try removing it and making a PR we can see if the current build matrix passes it.

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

3 participants