()
| 15 | |
| 16 | def monitor(stream_in, stream_out, extract_url=False): |
| 17 | def reader(): |
| 18 | with stream_in: |
| 19 | for line in stream_in: |
| 20 | stream_out.write(line) |
| 21 | |
| 22 | # Check for the publication message and extract URL |
| 23 | if extract_url: |
| 24 | match = re.search(r'.+ -> (.+)', line) |
| 25 | if match: |
| 26 | extracted_url[0] = match.group(1) |
| 27 | return reader |
| 28 | |
| 29 | threading.Thread(target=monitor(process.stdout, sys.stdout, True), daemon=True).start() |