From 3fed048f375a9839cdb3240c9ff59276beaaac23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Hohwiller?= Date: Tue, 9 Apr 2024 18:06:00 +0200 Subject: [PATCH] #260: additional fixes to also handle error of env command and log variables set and do not call ideasy without args --- cli/src/main/package/bin/ide | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cli/src/main/package/bin/ide b/cli/src/main/package/bin/ide index a0c459297..b08388c76 100644 --- a/cli/src/main/package/bin/ide +++ b/cli/src/main/package/bin/ide @@ -1,11 +1,12 @@ #!/usr/bin/env bash -# Call native ideasy with user-provided arguments -ideasy "$@" -return_code=$? -if [ $return_code -ne 0 ]; then # Check if ideasy exit code is not equal to 0 - echo -e "\n\033[91mError: IDEasy failed with exit code $return_code \033[91m" >&2 # Print error message to stderr - return $return_code # Return the same error code as ideasy +if [ $# != 0 ]; then + ideasy "$@" + return_code=$? + if [ $return_code != 0 ]; then + echo -e "\n\033[91mError: IDEasy failed with exit code ${return_code}\033[91m" >&2 + return ${return_code} + fi fi ide_env= @@ -14,5 +15,10 @@ if [ "${OSTYPE}" = "cygwin" ] || [ "${OSTYPE}" = "msys" ]; then else ide_env="$(ideasy env)" fi -eval "$ide_env" +if [ $? = 0 ]; then + eval "${ide_env}" + if [ $# = 0 ]; then + echo "IDE environment variables have been set for ${IDE_HOME} in workspace ${WORKSPACE}" + fi +fi unset ide_env