55
55
# Darwin, MinGW, and NonStop.
56
56
#
57
57
# (3) This script is generated from the Groovy template
58
- # https://github.com/gradle/gradle/blob/HEAD/subprojects/ plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/ plugins-application /src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
59
# within the Gradle project.
60
60
#
61
61
# You can find Gradle at https://github.com/gradle/gradle/.
94
94
# This is normally unused
95
95
# shellcheck disable=SC2034
96
96
APP_BASE_NAME=${0##*/ }
97
- APP_HOME=$( cd " ${APP_HOME:- ./ } " && pwd -P ) || exit
98
-
99
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
100
- DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
97
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
98
+ APP_HOME=$( cd " ${APP_HOME:- ./ } " > /dev/null && pwd -P ) || exit
101
99
102
100
# Use the maximum available, or set MAX_FD != -1 to use that value.
103
101
MAX_FD=maximum
@@ -144,26 +142,29 @@ location of your Java installation."
144
142
fi
145
143
else
146
144
JAVACMD=java
147
- which java > /dev/null 2>&1 || die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
145
+ if ! command -v java > /dev/null 2>&1
146
+ then
147
+ die " ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
148
148
149
149
Please set the JAVA_HOME variable in your environment to match the
150
150
location of your Java installation."
151
+ fi
151
152
fi
152
153
153
154
# Increase the maximum file descriptors if we can.
154
155
if ! " $cygwin " && ! " $darwin " && ! " $nonstop " ; then
155
156
case $MAX_FD in # (
156
157
max* )
157
158
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
158
- # shellcheck disable=SC3045
159
+ # shellcheck disable=SC2039, SC3045
159
160
MAX_FD=$( ulimit -H -n ) ||
160
161
warn " Could not query maximum file descriptor limit"
161
162
esac
162
163
case $MAX_FD in # (
163
164
' ' | soft) : ;; # (
164
165
* )
165
166
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
166
- # shellcheck disable=SC3045
167
+ # shellcheck disable=SC2039, SC3045
167
168
ulimit -n " $MAX_FD " ||
168
169
warn " Could not set maximum file descriptor limit to $MAX_FD "
169
170
esac
@@ -208,11 +209,15 @@ if "$cygwin" || "$msys" ; then
208
209
done
209
210
fi
210
211
211
- # Collect all arguments for the java command;
212
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
213
- # shell script including quotes and variable substitutions, so put them in
214
- # double quotes to make sure that they get re-expanded; and
215
- # * put everything else in single quotes, so that it's not re-expanded.
212
+
213
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
214
+ DEFAULT_JVM_OPTS=' "-Xmx64m" "-Xms64m"'
215
+
216
+ # Collect all arguments for the java command:
217
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
218
+ # and any embedded shellness will be escaped.
219
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
220
+ # treated as '${Hostname}' itself on the command line.
216
221
217
222
set -- \
218
223
" -Dorg.gradle.appname=$APP_BASE_NAME " \
@@ -252,4 +257,4 @@ eval "set -- $(
252
257
tr ' \n' ' '
253
258
) " ' "$@"'
254
259
255
- exec " $JAVACMD " " $@ "
260
+ exec " $JAVACMD " " $@ "
0 commit comments