Skip to content

Commit 02521ed

Browse files
fix: restore original capture_output passthrough to preserve streaming output
When capture_output=False, dbt output should stream directly to the terminal. The previous implementation always passed capture_output=True to _inner_run_command, which silently captured output that was meant to be streamed. Transient-error detection still works: - DbtCommandError path: output extracted from exc.proc_err - Failed-result path with capture: result.output available - Failed-result path without capture: output streamed to terminal, treated as non-transient (user already saw output) Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
1 parent f6a91db commit 02521ed

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

elementary/clients/dbt/command_line_dbt_runner.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,24 @@ def _before_retry(retry_state: RetryCallState) -> None:
182182
reraise=True,
183183
)
184184
def _attempt() -> DbtCommandResult:
185-
# Always capture output so transient-error detection can inspect
186-
# stdout/stderr. The original ``capture_output`` flag is still
187-
# honoured for logging behaviour (see below).
185+
# Pass through the original capture_output flag so that when
186+
# capture_output=False the subprocess streams output directly
187+
# to the terminal (preserving the pre-retry behaviour).
188+
# Transient-error detection still works because:
189+
# - DbtCommandError path: we extract output from exc.proc_err
190+
# (subprocess always captures on CalledProcessError).
191+
# - Failed-result path (capture_output=True or quiet=True):
192+
# result.output/stderr are available for pattern matching.
193+
# - Failed-result path (capture_output=False, quiet=False):
194+
# output streamed to terminal and result.output is None,
195+
# so is_transient_error receives None and won't match —
196+
# the failure is treated as non-transient and returned
197+
# immediately. This is acceptable because the user already
198+
# saw the output in real-time.
188199
try:
189200
result = self._inner_run_command(
190201
dbt_command_args,
191-
capture_output=True,
202+
capture_output=capture_output,
192203
quiet=quiet,
193204
log_output=log_output,
194205
log_format=log_format,

0 commit comments

Comments
 (0)