Skip to content

Commit 70aa921

Browse files
committed
fix
1 parent 6ff0f44 commit 70aa921

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/debug/server_dap.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,15 @@ def send **kw
214214
kw[:seq] = @seq += 1
215215
str = JSON.dump(kw)
216216
@mutex.synchronize do
217-
sock.write "Content-Length: #{str.bytesize}\r\n\r\n#{str}"
217+
unless sock.closed?
218+
sock.write "Content-Length: #{str.bytesize}\r\n\r\n#{str}"
219+
end
218220
end
219221
show_protocol '<', str
220222
end
223+
rescue => e
224+
$stderr.puts str
225+
raise
221226
end
222227

223228
def send_response req, success: true, message: nil, **kw

test/support/protocol_test_case.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ def attach_to_cdp_server
9393

9494
def req_dap_disconnect(terminate_debuggee:)
9595
send_dap_request 'disconnect', restart: false, terminateDebuggee: terminate_debuggee
96+
unless terminate_debuggee
97+
close_dap_writer
98+
res = find_response :event, 'terminated', 'V<D'
99+
end
96100
close_reader
97101
end
98102

@@ -438,6 +442,10 @@ def close_reader
438442
end
439443
end
440444

445+
def close_dap_writer
446+
@sock.close_write
447+
end
448+
441449
HOST = '127.0.0.1'
442450

443451
JAVASCRIPT_TYPE_TO_CLASS_MAPS = {

0 commit comments

Comments
 (0)