Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3351,6 +3351,7 @@ def generate():
execution = None
stop_event = threading.Event()
t_reader = None
temp_path_created = None
try:
# 1. Initialize execution record with arguments
execution = _start_execution_record(
Expand All @@ -3374,6 +3375,8 @@ def generate():
temp_fd, temp_path = tempfile.mkstemp(
suffix=".sh", prefix=".tmp_run_", dir=temp_dir
)
# Track created temp path so we can always clean it up
temp_path_created = temp_path
with os.fdopen(
temp_fd, "w", encoding="utf-8", newline="\n"
) as temp_f:
Expand Down Expand Up @@ -3623,7 +3626,7 @@ def stream_reader(stream, q):
proc,
execution,
run_id=run_id,
temp_path=run_path if run_path != full_path else None,
temp_path=(temp_path_created if temp_path_created is not None else (run_path if run_path != full_path else None)),
was_aborted=True,
error_message="Client disconnected",
stop_event=stop_event,
Expand All @@ -3636,7 +3639,7 @@ def stream_reader(stream, q):
proc,
execution,
run_id=run_id,
temp_path=run_path if run_path != full_path else None,
temp_path=(temp_path_created if temp_path_created is not None else (run_path if run_path != full_path else None)),
was_aborted=False,
error_message="Execution timed out",
stop_event=stop_event,
Expand All @@ -3654,7 +3657,7 @@ def stream_reader(stream, q):
proc,
execution,
run_id=run_id,
temp_path=run_path if run_path != full_path else None,
temp_path=(temp_path_created if temp_path_created is not None else (run_path if run_path != full_path else None)),
was_aborted=False,
error_message=str(e),
stop_event=stop_event,
Expand All @@ -3668,7 +3671,7 @@ def stream_reader(stream, q):
proc,
execution,
run_id=run_id,
temp_path=run_path if run_path != full_path else None,
temp_path=(temp_path_created if temp_path_created is not None else (run_path if run_path != full_path else None)),
stop_event=stop_event,
reader_thread=t_reader,
)
Expand Down
Loading