new_variant: clean-up on failure

If the build (launched by fails, clean up the new
variant before exiting. Previous implementation had the clean up
for ~/.new_variant.yaml in the wrong place, and it wouldn't get
called from the exit handler.

TEST=See testdata/ for full details.
Use `&&` to run a second command if the first one passes.
`cd testdata ; ./ hatch && echo PASS`
`cd testdata ; ./ waddledoo && echo PASS`
The case with hatch will show "PASS" but because waddledoo has an
issue right now, that line won't show the "PASS".
Near the end, you'll see a call to --abort as the
script cleans up and exits. ~/.new_variant.yaml (in the chroot)
will not exist, because it got cleaned up by the --abort.

Change-Id: I11a572c6b4e0729bc65f45987dce4395eb1fa661
Tested-by: Paul Fagerburg <>
Reviewed-by: Jack Rosenthal <>
Commit-Queue: Paul Fagerburg <>
1 file changed