unpack: remove file if error

This commit is contained in:
Mikhail Tergoev
2025-07-04 09:12:40 +03:00
parent 036957c729
commit f1315115c7

View File

@ -259,11 +259,13 @@ unpack () {
esac esac
create_new_dir "$2" create_new_dir "$2"
if [[ $skip_xattr == "1" ]] \ if [[ $skip_xattr == "1" ]] \
&& $command "$1" ${outarg}"$2" 2>&1 | grep -v "xattr" && $command "$1" ${outarg}"$2" 2>&1 | sed "/xattr/d"
then print_ok "Файл $1 распакован." then print_ok "Файл $1 распакован."
elif $command "$1" ${outarg}"$2" elif $command "$1" ${outarg}"$2"
then print_ok "Файл $1 распакован." then print_ok "Файл $1 распакован."
else fatal "Распаковать файл $1 не удалось!" else
try_remove_file "$1"
fatal "Распаковать файл $1 не удалось!"
fi fi
return 0 return 0
} }