set result if we bail

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2026-11-28 05:24:11 +00:00
parent 06558f0601
commit 81527c69b2
+7 -5
View File
@@ -107,7 +107,7 @@ error() {
# 3: no handler
handle_target() {
declare -n result=$1
declare h cmd regex target_is_file target target_left cmd_is_template
declare h cmd regex target_is_file target target_left cmd_is_template _ec
cmd_append_target=1
match=0
target=$2
@@ -118,9 +118,10 @@ handle_target() {
[[ "$target" =~ ^/.* ]] || { target="${PWD}/${target}"; } # Turn relative paths to absolute ones.
file_raw=$( file -ib "$target" )
(( $? )) && {
file_raw=$( file -ib "$target" ); _ec=$?
(( $_ec )) && {
error "Failed to get mimetype, bailing"
result=$_ec
return 1
}
@@ -130,9 +131,10 @@ handle_target() {
[[ $target_mimetype == 'inode/symlink' ]] && {
unset file_raw
file_raw=$( file -ibL "$target" )
(( $? )) && {
file_raw=$( file -ibL "$target" ); _ec=$?
(( $_ec )) && {
error "Failed to get mimetype, bailing"
result=$_ec
return 1
}