Skip to content

Commit

Permalink
Force tty when setuping bundler to not show backtrace
Browse files Browse the repository at this point in the history
Closes #677.
  • Loading branch information
rafaelfranca committed Sep 21, 2022
1 parent 828c875 commit 39cb7af
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/spring/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ def self.command(name)
config = File.expand_path("~/.spring.rb")
require config if File.exist?(config)

# If the config/spring.rb contains requires for commands from other gems,
# then we need to be under bundler.
require "bundler/setup"
# We force the TTY so bundler doesn't show a backtrace in case gems are missing.
old_env = ENV["BUNDLER_FORCE_TTY"]
ENV["BUNDLER_FORCE_TTY"] = "true"
begin
# If the config/spring.rb contains requires for commands from other gems,
# then we need to be under bundler.
require "bundler/setup"
ensure
ENV["BUNDLER_FORCE_TTY"] = old_env
end

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

0 comments on commit 39cb7af

Please sign in to comment.