Skip to content

Commit

Permalink
Use return instead of exit in functions
Browse files Browse the repository at this point in the history
Fixed: `ffcast -ww each` would print only the 1st selection.
  • Loading branch information
ropery committed Oct 3, 2016
1 parent 9f94de5 commit 3c7d743
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ffcast.bash
Expand Up @@ -332,7 +332,7 @@ run_subcmd_or_command() {
local sub_cmd=$1
if [[ -z $sub_cmd ]]; then
run_default_command
exit
return
fi
if [[ -v sub_commands[$sub_cmd] ]]; then
shift
Expand All @@ -342,10 +342,10 @@ run_subcmd_or_command() {
else
error "sub-command '%s' function '%s' not found" "$sub_cmd" \
"$sub_cmd_func"
exit 1
return 1
fi
else
run_external_command "$@" || exit
run_external_command "$@"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion src/subcmd.bash
Expand Up @@ -96,7 +96,7 @@ subcmd_pad() {
let 'rect_x -= l' 'rect_y -= t' 'rect_X -= r' 'rect_Y -= b' || :
verbose 'padding: top=%d right=%d bottom=%d left=%d' "$t" "$r" "$b" "$l"
offsets="$rect_x $rect_y $rect_X $rect_Y"
set_region_vars_by_offsets || exit
set_region_vars_by_offsets || return
run_subcmd_or_command "$@"
}

Expand Down

0 comments on commit 3c7d743

Please sign in to comment.