[arch-releng] [PATCH] Check exit code argument otherwise the exit code is the one from the last command

Dieter Plaetinck dieter at plaetinck.be
Sun Apr 24 07:22:57 EDT 2011


On Wed, 20 Apr 2011 11:40:39 +0200
Charles Vejnar <ce at vejnar.org> wrote:

> ---
>  src/core/libs/lib-flowcontrol.sh |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/core/libs/lib-flowcontrol.sh b/src/core/libs/lib-flowcontrol.sh
> index 4f3bbfa..9b7593c 100755
> --- a/src/core/libs/lib-flowcontrol.sh
> +++ b/src/core/libs/lib-flowcontrol.sh
> @@ -215,8 +215,13 @@ start_installer ()
>  # $1 exit code (optional)
>  stop_installer ()
>  {
> +	if [ -z "$1" ]; then 
> +		exit_code=0
> +	else
> +		exit_code=$1
> +	fi
>  	log "-------------- STOPPING INSTALLATION ----------"
>  	cleanup_runtime
>  	[ "$var_UI_TYPE" = dia ] && clear
> -	exit $1
> +	exit $exit_code
>  }

thanks for the find.
your patch was not very pretty, so i fixed it like this:
https://github.com/Dieterbe/aif/commit/ea7010cef98714545b24999588c33661ad7f8efa

this also inspired me for this:
https://github.com/Dieterbe/aif/commit/cfeaf0e3b7d8c2b75cf66361e330906f4fed5f7d

now aif's exitcode should be that of the last failing phase.

Dieter


More information about the arch-releng mailing list