fix: infra: _regen_file does not restore stash if generator fails — compose file lost at temp path (#784)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
defec3b255
commit
f90702f930
1 changed files with 8 additions and 2 deletions
10
bin/disinto
10
bin/disinto
|
|
@ -1545,8 +1545,14 @@ _regen_file() {
|
|||
mv "$target" "$stashed"
|
||||
fi
|
||||
|
||||
# Run the generator — it writes $target from scratch
|
||||
"$generator" "$@"
|
||||
# Run the generator — it writes $target from scratch.
|
||||
# If the generator fails, restore the stashed original so it is not stranded.
|
||||
if ! "$generator" "$@"; then
|
||||
if [ -n "$stashed" ]; then
|
||||
mv "$stashed" "$target"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "$stashed" ]; then
|
||||
# No previous file — first generation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue