This commit refactors the logic for purging the build directory in the run_fbuild_cli function. It now uses a try-except block to handle PermissionError exceptions when attempting to purge the build directory.
Rationale
Fixes Bug
Testing/Review Recommendations
For the testing I did a manual test, the procedure I followed was the following one:
Execute `fprime-util generate
Execute fprime-util build
Change a file to immutable e.g sudo chattr +i build-fprime-automatic-native/lib/Linux/libFw_Buffer.a
Execute fprime-util purge
The output shows which file cannot be removed as shown below.
[INFO] Purge build directory at: <path>/fprime/testv1/build-fprime-automatic-native
Purge this directory? (yes/no) [yes]: yes
Error: Permission denied while purging <path>/fprime/testprj/build-fprime-automatic-native: [Errno 1] Operation not permitted: 'libFw_Buffer.a'
Change Description
This commit refactors the logic for purging the build directory in the
run_fbuild_cli
function. It now uses atry-except
block to handlePermissionError
exceptions when attempting to purge the build directory.Rationale
Fixes Bug
Testing/Review Recommendations
For the testing I did a manual test, the procedure I followed was the following one:
fprime-util build
sudo chattr +i build-fprime-automatic-native/lib/Linux/libFw_Buffer.a
fprime-util purge
Future Work
Maybe unit tests, if necessary...