Skip to content

Commit 3fed048

Browse files
committed
#260: additional fixes to also handle error of env command and log variables set and do not call ideasy without args
1 parent f050774 commit 3fed048

File tree

1 file changed

+13
-7
lines changed
  • cli/src/main/package/bin

1 file changed

+13
-7
lines changed

cli/src/main/package/bin/ide

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env bash
22

3-
# Call native ideasy with user-provided arguments
4-
ideasy "$@"
5-
return_code=$?
6-
if [ $return_code -ne 0 ]; then # Check if ideasy exit code is not equal to 0
7-
echo -e "\n\033[91mError: IDEasy failed with exit code $return_code \033[91m" >&2 # Print error message to stderr
8-
return $return_code # Return the same error code as ideasy
3+
if [ $# != 0 ]; then
4+
ideasy "$@"
5+
return_code=$?
6+
if [ $return_code != 0 ]; then
7+
echo -e "\n\033[91mError: IDEasy failed with exit code ${return_code}\033[91m" >&2
8+
return ${return_code}
9+
fi
910
fi
1011

1112
ide_env=
@@ -14,5 +15,10 @@ if [ "${OSTYPE}" = "cygwin" ] || [ "${OSTYPE}" = "msys" ]; then
1415
else
1516
ide_env="$(ideasy env)"
1617
fi
17-
eval "$ide_env"
18+
if [ $? = 0 ]; then
19+
eval "${ide_env}"
20+
if [ $# = 0 ]; then
21+
echo "IDE environment variables have been set for ${IDE_HOME} in workspace ${WORKSPACE}"
22+
fi
23+
fi
1824
unset ide_env

0 commit comments

Comments
 (0)