fix(runner): remove the run-output scratch dir on exit#811
Merged
Conversation
Every invocation created $TMPDIR/bashunit/run/<os>/<random> (#801) but nothing removed it, leaking one directory per run — ~9.9k dirs had accumulated locally. - env.sh gains a guarded cleanup (mirrors parallel::cleanup's path check) and arms it via an EXIT trap for early-exit paths (--version, --help, doc, ...). - The test-run path replaces that trap in main.sh, so cmd_test calls the cleanup explicitly after rerun::persist (which reads from the run dir), and the Ctrl-C / stop-on-failure handlers do the same before their exits. - Sourcing errors are captured in the run dir as well: files are sourced sequentially in the parent (workers fork after), so a fixed truncated-per-file path is safe and saves a mktemp and an rm fork per test file. Runs killed with SIGKILL still cannot clean up (no trap runs); a full local suite now leaves ~6 dirs instead of ~258.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 Background
Every invocation created
$TMPDIR/bashunit/run/<os>/<random>(#801) but nothing removed it — one leaked directory per run (~9.9k had accumulated locally; the acceptance suite alone leaks ~258 per pass).💡 Changes
parallel::cleanup), armed via an EXIT trap for early-exit paths (--version,--help, subcommands).cmd_testcalls the cleanup explicitly afterrerun::persist; Ctrl-C and stop-on-failure handlers do the same.mktemp+rmfork per test file.TMPDIRand asserts nothing is left. SIGKILLed runs still can't clean up (no trap runs); a full suite now leaves ~6 dirs instead of ~258.