1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[bundler/bundler] Respect color option when instantiating shells

Thor's base shell will be memoized the first time it is set. So if we
instantiate a no-color shell first, further instantiations of a bundler
shell will be initialized with a no-color shell by default. This is
caused some sources specs to fail, depending on the order they run.

See for example https://travis-ci.org/bundler/bundler/builds/500328994.

What we do to fix it is to reset the shell unless no-color is explicitly
specified. That way, further instantiations will rerun thor's internal
logic to choose the default shell.

786b5d9894
This commit is contained in:
David Rodríguez 2019-05-24 20:28:25 +02:00 committed by Hiroshi SHIBATA
parent b95756c7a9
commit 580e165873
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 1 additions and 15 deletions

View file

@ -10,9 +10,7 @@ module Bundler
attr_writer :shell
def initialize(options = {})
if options["no-color"]
Thor::Base.shell = Thor::Shell::Basic
end
Thor::Base.shell = options["no-color"] ? Thor::Shell::Basic : nil
@shell = Thor::Base.shell.new
@level = ENV["DEBUG"] ? "debug" : "info"
@warning_history = []