-
Notifications
You must be signed in to change notification settings - Fork 553
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
Lazy-load io/console to avoid activating the gem unecessarily #539
Conversation
Ping on getting this reviewed? Thanks! |
Hey, have you found it to be performance issue? I'm curious to see whether hiding file dependency in the bowels of codebase is good enough tradeoff? |
The main reason to lazy loading it is that it is being extracted to a gem in Ruby 2.4+ and it may not be present in a ruby installation. It also is only necessary if the ruby installation doesn't have readline. This change does make sense. Thanks. |
Its not a performance issue, but rather an issue for bundler & other gems -- if io-console is eagerly loaded, then the user cannot control what version is used |
I'm asking cuz I'm in a similar boat relying on 'io-console' and in particular in changing echo mode. I guess I'm looking for a robust solution. For example, what will happen if you're running on Ruby 2.4 and |
Yeah, that is what would happen today. We can improve it though with a fallback. |
- On Fedora 25, Bundler will outright crash as it has a hard dependency on io/console by way of the Thor CLI library. Bundler 1.14-6 vendors Thor 0.19.1 https://github.com/bundler/bundler/blob/v1.14.6/lib/bundler/vendor/thor/lib/thor/version.rb https://github.com/erikhuda/thor/blob/v0.19.1/lib/thor/shell/basic.rb#L2 The hard dependency has been removed in an as of yet unshipped version of Thor via rails/thor#539 meaning that at some point it will not be necessary to have io/console installed for Bundler. For now, it remains a hard dependency, without which calling Bundler will fail with an error like: /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/ui/shell.rb:15:in `initialize' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `new' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `rescue in start' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:17:in `start' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>' from /usr/local/bin/bundle:23:in `load' from /usr/local/bin/bundle:23:in `<main>'
- On Fedora 25, Bundler will outright crash as it has a hard dependency on io/console by way of the Thor CLI library. Bundler 1.14-6 vendors Thor 0.19.1 https://github.com/bundler/bundler/blob/v1.14.6/lib/bundler/vendor/thor/lib/thor/version.rb https://github.com/erikhuda/thor/blob/v0.19.1/lib/thor/shell/basic.rb#L2 The hard dependency has been removed in an as of yet unshipped version of Thor via rails/thor#539 meaning that at some point it will not be necessary to have io/console installed for Bundler. For now, it remains a hard dependency, without which calling Bundler will fail with an error like: /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/ui/shell.rb:15:in `initialize' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `new' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `rescue in start' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:17:in `start' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>' from /usr/local/bin/bundle:23:in `load' from /usr/local/bin/bundle:23:in `<main>'
- On Fedora 25, Bundler will outright crash as it has a hard dependency on io/console by way of the Thor CLI library. Bundler 1.14-6 vendors Thor 0.19.1 https://github.com/bundler/bundler/blob/v1.14.6/lib/bundler/vendor/thor/lib/thor/version.rb https://github.com/erikhuda/thor/blob/v0.19.1/lib/thor/shell/basic.rb#L2 The hard dependency has been removed in an as of yet unshipped version of Thor via rails/thor#539 meaning that at some point it will not be necessary to have io/console installed for Bundler. For now, it remains a hard dependency, without which calling Bundler will fail with an error like: /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/ui/shell.rb:15:in `initialize' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `new' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `rescue in start' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:17:in `start' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>' from /usr/local/bin/bundle:23:in `load' from /usr/local/bin/bundle:23:in `<main>'
- On Fedora 25, Bundler will outright crash as it has a hard dependency on io/console by way of the Thor CLI library. Bundler 1.14-6 vendors Thor 0.19.1 https://github.com/bundler/bundler/blob/v1.14.6/lib/bundler/vendor/thor/lib/thor/version.rb https://github.com/erikhuda/thor/blob/v0.19.1/lib/thor/shell/basic.rb#L2 The hard dependency has been removed in an as of yet unshipped version of Thor via rails/thor#539 meaning that at some point it will not be necessary to have io/console installed for Bundler. For now, it remains a hard dependency, without which calling Bundler will fail with an error like: /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/ui/shell.rb:15:in `initialize' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `new' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `rescue in start' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:17:in `start' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>' from /usr/local/bin/bundle:23:in `load' from /usr/local/bin/bundle:23:in `<main>'
- On Fedora 25, Bundler will outright crash as it has a hard dependency on io/console by way of the Thor CLI library. Bundler 1.14-6 vendors Thor 0.19.1 https://github.com/bundler/bundler/blob/v1.14.6/lib/bundler/vendor/thor/lib/thor/version.rb https://github.com/erikhuda/thor/blob/v0.19.1/lib/thor/shell/basic.rb#L2 The hard dependency has been removed in an as of yet unshipped version of Thor via rails/thor#539 meaning that at some point it will not be necessary to have io/console installed for Bundler. For now, it remains a hard dependency, without which calling Bundler will fail with an error like: /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- io/console (LoadError) from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:2:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell/color.rb:1:in `<top (required)>' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/shell.rb:17:in `shell' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/ui/shell.rb:15:in `initialize' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `new' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:13:in `rescue in start' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:17:in `start' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>' from /usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors' from /usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>' from /usr/local/bin/bundle:23:in `load' from /usr/local/bin/bundle:23:in `<main>'
No description provided.