Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ def packet_type_is(packet, packet_type):


def dump_dap_log(log_file):
print("========= DEBUG ADAPTER PROTOCOL LOGS =========")
print("========= DEBUG ADAPTER PROTOCOL LOGS =========", file=sys.stderr)
if log_file is None:
print("no log file available")
print("no log file available", file=sys.stderr)
else:
with open(log_file, "r") as file:
print(file.read())
print("========= END =========")
print(file.read(), file=sys.stderr)
print("========= END =========", file=sys.stderr)


def read_packet_thread(vs_comm, log_file):
Expand All @@ -107,6 +107,14 @@ def read_packet_thread(vs_comm, log_file):
# termination of lldb-dap and stop waiting for new packets.
done = not vs_comm.handle_recv_packet(packet)
finally:
# Wait for the process to fully exit before dumping the log file to
# ensure we have the entire log contents.
if vs_comm.process is not None:
try:
# Do not wait forever, some logs are better than none.
vs_comm.process.wait(timeout=20)
except subprocess.TimeoutExpired:
pass
dump_dap_log(log_file)


Expand Down Expand Up @@ -1274,7 +1282,11 @@ def terminate(self):
super(DebugAdapterServer, self).terminate()
if self.process is not None:
self.process.terminate()
self.process.wait()
try:
self.process.wait(timeout=20)
except subprocess.TimeoutExpired:
self.process.kill()
self.process.wait()
self.process = None


Expand Down