Skip to content

Commit

Permalink
#260: additional fixes to also handle error of env command and log va…
Browse files Browse the repository at this point in the history
…riables set and do not call ideasy without args
  • Loading branch information
hohwille committed Apr 9, 2024
1 parent f050774 commit 3fed048
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions cli/src/main/package/bin/ide
Original file line number Diff line number Diff line change
@@ -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=
Expand All @@ -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

0 comments on commit 3fed048

Please sign in to comment.