Skip to content

Commit 39cb7af

Browse files
committed
Force tty when setuping bundler to not show backtrace
Closes #677.
1 parent 828c875 commit 39cb7af

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/spring/commands.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,16 @@ def self.command(name)
2828
config = File.expand_path("~/.spring.rb")
2929
require config if File.exist?(config)
3030

31-
# If the config/spring.rb contains requires for commands from other gems,
32-
# then we need to be under bundler.
33-
require "bundler/setup"
31+
# We force the TTY so bundler doesn't show a backtrace in case gems are missing.
32+
old_env = ENV["BUNDLER_FORCE_TTY"]
33+
ENV["BUNDLER_FORCE_TTY"] = "true"
34+
begin
35+
# If the config/spring.rb contains requires for commands from other gems,
36+
# then we need to be under bundler.
37+
require "bundler/setup"
38+
ensure
39+
ENV["BUNDLER_FORCE_TTY"] = old_env
40+
end
3441

3542
# Auto-require any Spring extensions which are in the Gemfile
3643
Gem::Specification.map(&:name).grep(/^spring-/).each do |command|

0 commit comments

Comments
 (0)