Skip to content

Commit bba631d

Browse files
committed
treat read exit code 1 at EOF as expected behavior
1 parent 95c3a0b commit bba631d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

functions/gnu_generic_getopts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function gnu_generic_getopts() {
77

88
if [[ "$1" == "-" ]]; then
99
builtin declare -g HELP_MESSAGE
10-
IFS= builtin read -rd '' HELP_MESSAGE
10+
IFS= builtin read -rd '' HELP_MESSAGE || true
1111
exec 6< <(builtin echo "$HELP_MESSAGE")
1212
else
1313
builtin declare app="${1:?The function parse_gnu_help requires a function/command which outputs the GNU-compatibled help message}";
@@ -19,7 +19,7 @@ function gnu_generic_getopts() {
1919
builtin shift
2020
OPTIONS[help]=true
2121
ARGUMENTS=("$@")
22-
IFS= builtin read -u 6 -rd '' HELP_MESSAGE
22+
IFS= builtin read -u 6 -rd '' HELP_MESSAGE || true
2323
builtin echo "$HELP_MESSAGE"
2424
builtin return 1
2525
fi

0 commit comments

Comments
 (0)