mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
fix(aws): use return instead of exit in state helpers to avoid killing the shell
`_aws_update_state` and `_aws_clear_state` ran `... || exit 1` when the directory of `$AWS_STATE_FILE` did not exist. These helpers are sourced functions invoked from `asp`/`asr` (and profile clearing), so `exit 1` terminates the user's interactive shell (the terminal closes) instead of just aborting the helper. Use `return 1` so a missing state directory aborts only the helper, leaving the interactive shell intact. Only affects users who set `AWS_PROFILE_STATE_ENABLED=true`.
This commit is contained in:
parent
c954bbb168
commit
d4a9158a5c
1 changed files with 2 additions and 2 deletions
|
|
@ -9,14 +9,14 @@ function agr() {
|
||||||
# Update state file if enabled
|
# Update state file if enabled
|
||||||
function _aws_update_state() {
|
function _aws_update_state() {
|
||||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
test -d $(dirname ${AWS_STATE_FILE}) || return 1
|
||||||
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _aws_clear_state() {
|
function _aws_clear_state() {
|
||||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||||
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
test -d $(dirname ${AWS_STATE_FILE}) || return 1
|
||||||
echo -n > "${AWS_STATE_FILE}"
|
echo -n > "${AWS_STATE_FILE}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue