Skip to content

Commit 5bc746b

Browse files
committed
Fix pipeline chain skipping failed steps
on_done was called unconditionally in the finally block, so when a step failed (e.g. canvasapi missing → exit code 1), the pipeline silently advanced to the next step. This caused "Generate notes" to run even though "Download videos" had failed — and since console.clear() runs at the start of each step, the user only saw the last running step. Fix: initialize rc = -1 before the try block, only call on_done when rc == 0. A failed step now halts the chain and leaves the error visible.
1 parent f8d2660 commit 5bc746b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

gui.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ def _append_line(text: str, color: str | None = None) -> None:
449449
)
450450

451451
def _worker() -> None:
452+
rc = -1
452453
try:
453454
env = {**os.environ, "PYTHONUNBUFFERED": "1"}
454455
state.proc = subprocess.Popen(
@@ -490,7 +491,7 @@ def _worker() -> None:
490491
_append_line("\n✓ Completed successfully.", C_SUCCESS)
491492
self.set_status("✓ done", C_SUCCESS)
492493
elif rc == -15:
493-
pass
494+
pass # user stopped it
494495
else:
495496
_append_line(f"\n✗ Exited with code {rc}.", C_ERROR)
496497
self.set_status(f"✗ code {rc}", C_ERROR)
@@ -502,7 +503,9 @@ def _worker() -> None:
502503
state.proc = None
503504
self._stop_btn.visible = False
504505
self.page.update()
505-
if on_done:
506+
# Only advance the pipeline chain when the step succeeded.
507+
# On failure rc != 0 — stop the chain so the user sees the error.
508+
if on_done and rc == 0:
506509
on_done()
507510
threading.Thread(target=_worker, daemon=True).start()
508511

0 commit comments

Comments
 (0)