FIX: in some case bundle exec fails from spawn

there is some bundler magic in here, prefer bin stubs anyway
cause they are a bit faster
This commit is contained in:
Sam 2017-04-13 17:24:58 -04:00
parent 809fbb25ce
commit 2d636406dc
1 changed files with 6 additions and 4 deletions

View File

@ -7,15 +7,17 @@ module Autospec
def run(specs)
puts "Running Rspec: " << specs
# kill previous rspec instance
abort
self.abort
# we use our custom rspec formatter
args = ["-r", "#{File.dirname(__FILE__)}/formatter.rb",
"-f", "Autospec::Formatter", specs.split].flatten.join(" ")
# launch rspec
@pid = Process.spawn({"RAILS_ENV" => "test"}, "bundle exec rspec #{args}")
Dir.chdir(Rails.root) do
@pid = Process.spawn({"RAILS_ENV" => "test"}, "bin/rspec #{args}")
_, status = Process.wait2(@pid)
status.exitstatus
end
end
def abort
if @pid