MCPcopy Create free account
hub / github.com/ddnet/ddnet / thread

Function thread

scripts/integration_test.py:275–289  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273
274def run_lines_thread(name, file, output_filename, output_list, output_queue):
275 def thread():
276 output_file = None
277 for line in file:
278 if output_file is None:
279 output_file = open(output_filename, "w", buffering=1, encoding="utf-8") # line buffering
280 output_file.write(line)
281 line = line.rstrip("\r\n")
282 output_list.append(line)
283 if output_queue is not None:
284 try:
285 output_queue.put(Log.parse(line))
286 except ValueError:
287 # The client will sometimes print multiple log lines without timestamp and level, for example on assertion errors.
288 # We store log lines verbatim if they could not be parsed, so we can output the log lines on test failures.
289 output_queue.put(Log(timestamp=None, level=None, line=line))
290
291 Thread(name=name, target=thread, daemon=True).start()
292

Callers 2

StartMethod · 0.85
Cmd_PreInitFunction · 0.85

Calls 8

LogClass · 0.85
ExitClass · 0.85
UncleanExitClass · 0.85
TimeoutClass · 0.85
TestTimeoutClass · 0.85
remaining_durationMethod · 0.80
getMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected