mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 11:31:46 +00:00
refactor: enhance install script robustness with improved error handling, option validation, and safer file operations, and add error checking for alias removal during uninstall.
This commit is contained in:
8
mole
8
mole
@@ -622,9 +622,13 @@ remove_mole() {
|
||||
if [[ -f "$alias" ]]; then
|
||||
# Check if directory requires sudo
|
||||
if [[ ! -w "$(dirname "$alias")" ]]; then
|
||||
sudo rm -f "$alias" 2> /dev/null || true
|
||||
if ! sudo rm -f "$alias" 2> /dev/null; then
|
||||
has_error=true
|
||||
fi
|
||||
else
|
||||
rm -f "$alias" 2> /dev/null || true
|
||||
if ! rm -f "$alias" 2> /dev/null; then
|
||||
has_error=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user