Skip to content

Commit 583e6ee

Browse files
fix: catch Exception instead of BaseException in writer thread, re-raise KeyboardInterrupt/SystemExit
Co-Authored-By: unknown <>
1 parent 649e0e0 commit 583e6ee

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

airbyte_cdk/entrypoint.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def _nonblocking_write_to_stdout(messages: Iterable[str]) -> None:
436436
_WRITE_QUEUE_SIZE = 1000
437437
_WATCHDOG_TIMEOUT_S = 600
438438
write_queue: queue.Queue[Optional[bytes]] = queue.Queue(maxsize=_WRITE_QUEUE_SIZE)
439-
writer_error: List[BaseException] = []
439+
writer_error: List[Exception] = []
440440

441441
def _stdout_writer() -> None:
442442
"""Dedicated thread that writes queued messages to stdout."""
@@ -449,7 +449,9 @@ def _stdout_writer() -> None:
449449
while total < len(data):
450450
written = os.write(real_fd, data[total:])
451451
total += written
452-
except BaseException as exc:
452+
except (KeyboardInterrupt, SystemExit):
453+
raise
454+
except Exception as exc:
453455
writer_error.append(exc)
454456

455457
writer = threading.Thread(target=_stdout_writer, name="stdout-writer", daemon=True)

0 commit comments

Comments
 (0)