Skip to content

fix: replace panics with exitError and add timeout to external --exec command#52

Open
jonbaldie wants to merge 1 commit into
avito-tech:masterfrom
jonbaldie:fix/exec-and-panics
Open

fix: replace panics with exitError and add timeout to external --exec command#52
jonbaldie wants to merge 1 commit into
avito-tech:masterfrom
jonbaldie:fix/exec-and-panics

Conversation

@jonbaldie
Copy link
Copy Markdown

OS-level errors in the main loop (MkdirTemp, MkdirAll, CopyFile) panicked with a raw stack trace instead of a readable message, and the --do-not-remove-tmp-folder flag meant the cleanup only happened in one place so an early return leaked the temp dir; this PR replaces all those panics with exitError returns, moves cleanup into a defer, and fixes the external --exec path to use exec.CommandContext so it is killed after --exec-timeout seconds (returning exit code 2/skip on deadline exceeded) rather than hanging forever.

…ommand

Replaces five panic calls for OS-level errors (MkdirTemp, MkdirAll,
CopyFile, and exec.Run) with clean exitError returns. Moves tmpDir
cleanup into a defer so it runs even when an error returns early from
the file loop. Fixes the external --exec path: uses CommandContext so
the process is killed after --exec-timeout seconds (treating
deadline-exceeded as exit code 2/skip), falls back to 10s when timeout
is zero, and removes the Start/Wait pair along with its TODO comment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant