install-aws-server: Use correct fd and exit code for usage message.

On --help, write to stdout and exits with 0; on error, write to stderr
and exit with 1.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-01-04 12:08:35 -08:00 committed by Tim Abbott
parent d4190c36be
commit 8a8e538af7
1 changed files with 5 additions and 3 deletions

View File

@ -29,10 +29,12 @@ image_id=ami-0dc45e3d9be6ab7b5
instance_type=m4.large instance_type=m4.large
ssh_secret_id=prod/git/deploy ssh_secret_id=prod/git/deploy
EOF EOF
exit 1
} }
args="$(getopt -o '' --long help,branch:,roles:,debug-key: -n "$0" -- "$@")" || usage args="$(getopt -o '' --long help,branch:,roles:,debug-key: -n "$0" -- "$@")" || {
usage >&2
exit 1
}
eval "set -- $args" eval "set -- $args"
BRANCH="main" BRANCH="main"
@ -67,7 +69,7 @@ while true; do
done done
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
usage usage >&2
exit 1 exit 1
fi fi