Open celskeggs opened 1 week ago
FYI if anyone would like to take a crack at this: The issue seems to be that we try to load the build before purging it. But since the build is invalid, it gets skipped. We may want to either skip the build loading if possible, or (more likely easier) handle the failure nicely.
For what it's worth, fprime-util purge -f
does work fine.
This was originally by design. It pointed out that we shouldn't be removing directories that our tools "don't understand".
Thus purge
was intended for well-formed directories where it is clear that our tools created them....and and purge -f
was created for clobbering anything following the naming scheme.
I am happy to review this behavior, or change it should the community agree that one is desired behavior over the other.
I'm okay with the idea that fprime-util purge
won't delete a directory that wasn't created with the F Prime tools and it can't understand. But if the directory was made with the F Prime tools, fprime-util purge
should always be able to understand it.
One possibility: the first step in fprime-util generate
after creating the directory could be to add a special file (.fprime-build-dir
or something better named) to mark it as an F Prime directory. That way, if the build generation step fails, there will still be a marker telling fprime-util purge
that it's OK to delete the directory. (If someone Ctrl-C'd fprime-util generate
before it managed to create that file, then the directory will be empty, and I have no concerns with accidentally deleting an empty directory.)
I like this solution!
Problem Description
I interrupted the generate command with Ctrl-C, and now I have a build directory that the purge command won't remove.
Context / Environment
How to Reproduce
fprime-util generate --ninja
and hit Ctrl-C partway through.fprime-util purge
fprime-util generate --ninja
Expected Behavior
fprime-util purge
should remove the build directory even if it is broken, so thatfprime-util generate --ninja
can generate a clean build directory.