|
|
@@ -15,6 +15,7 @@ import select |
|
|
|
import pathlib |
|
|
|
import threading |
|
|
|
import subprocess |
|
|
|
import _thread # for interrupt_main |
|
|
|
|
|
|
|
import typing |
|
|
|
|
|
|
@@ -359,7 +360,14 @@ def main(argv: typing.List[str]): |
|
|
|
sys.stdout.flush() |
|
|
|
captured_output.append(line) |
|
|
|
fh.close() |
|
|
|
reader = threading.Thread(target=reader_thread, args=(borg.stdout,)) |
|
|
|
def _reader_thread(fh): |
|
|
|
try: |
|
|
|
return reader_thread(fh) |
|
|
|
except BrokenPipeError: |
|
|
|
pass |
|
|
|
except Exception: |
|
|
|
_thread.interrupt_main() |
|
|
|
reader = threading.Thread(target=_reader_thread, args=(borg.stdout,)) |
|
|
|
reader.daemon = True |
|
|
|
reader.start() |
|
|
|
|
|
|
|