File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
lib/ruby_lsp/test_reporters Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ module RubyLsp
9
9
class LspReporter
10
10
include Singleton
11
11
12
+ #: bool
13
+ attr_reader :invoked_shutdown
14
+
12
15
#: -> void
13
16
def initialize
14
17
port = ENV [ "RUBY_LSP_REPORTER_PORT" ]
@@ -19,6 +22,8 @@ def initialize
19
22
require "stringio"
20
23
StringIO . new
21
24
end #: IO | StringIO
25
+
26
+ @invoked_shutdown = false #: bool
22
27
end
23
28
24
29
#: -> void
@@ -34,6 +39,8 @@ def shutdown
34
39
# reporter, use `shutdown` instead
35
40
#: -> void
36
41
def internal_shutdown
42
+ @invoked_shutdown = true
43
+
37
44
send_message ( "finish" )
38
45
@io . close
39
46
end
@@ -161,4 +168,10 @@ def send_message(method_name, **params)
161
168
File . write ( File . join ( ".ruby-lsp" , "coverage_result.json" ) , coverage_results . to_json )
162
169
RubyLsp ::LspReporter . instance . internal_shutdown
163
170
end
171
+ elsif ENV [ "RUBY_LSP_TEST_RUNNER" ] && !ENV [ "RUBY_LSP_ENV" ] == "test"
172
+ at_exit do
173
+ # If the test process crashed immediately without finishing the tests, we still need to tell the extension that the
174
+ # execution ended so that it can clean up
175
+ RubyLsp ::LspReporter . instance . internal_shutdown unless RubyLsp ::LspReporter . instance . invoked_shutdown
176
+ end
164
177
end
You can’t perform that action at this time.
0 commit comments