When --random is used, the runner writes the shuffled spec list to
$SHELLSPEC_INFILE, which defaulted to the relative path "file". That left a
stray "file" in the working/project directory, truncating any existing
./file, and — unlike every other internal scratch file, which lives under
$SHELLSPEC_TMPBASE and is removed by cleanup() — it was never cleaned up.
Set SHELLSPEC_INFILE to "$SHELLSPEC_TMPBASE/.shellspec-infile" alongside the
sibling temporary files so it is isolated, never clobbers a user's file, and
is removed on exit. Add a regression spec that runs the binary with --random
and asserts no stray file is left in the working directory.
When --random is used, the runner writes the shuffled spec list to $SHELLSPEC_INFILE, which defaults to the relative path file. This drops a stray file named file into the working/project directory, silently overwrites any existing ./file, and is never cleaned up, unlike every other internal scratch file.
Reproduce this issue with:
Along with this fix: