Skip to content

Commit fcbc3a1

Browse files
committed
Wait for activation under a mutex lock
1 parent 8b4f29e commit fcbc3a1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/test_helper.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,23 @@ class TestCase
3232
extend T::Sig
3333
include RubyLsp::TestHelper
3434

35+
def before_setup
36+
super
37+
@mutex = Mutex.new
38+
end
39+
3540
sig { returns(String) }
3641
def dummy_root
3742
File.expand_path("#{__dir__}/dummy")
3843
end
3944

4045
sig { void }
4146
def wait_for_rails_addon_activation
42-
Thread.new do
43-
T.cast(RubyLsp::Addon.addons.first, RubyLsp::Rails::Addon).rails_runner_client
44-
end.join
47+
@mutex.synchronize do
48+
Thread.new do
49+
T.cast(RubyLsp::Addon.addons.first, RubyLsp::Rails::Addon).rails_runner_client
50+
end.join
51+
end
4552
end
4653

4754
sig { params(server: RubyLsp::Server).returns(RubyLsp::Result) }

0 commit comments

Comments
 (0)