Skip to content

Commit c8245b1

Browse files
committed
[OPENJDK-104] avoid passing JAVA_APP_NAME through subshell
Avoid quoting issues caused by passing JAVA_APP_NAME through subshells. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent e759661 commit c8245b1

File tree

1 file changed

+5
-9
lines changed
  • modules/run/artifacts/opt/jboss/container/java/run

1 file changed

+5
-9
lines changed

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,6 @@ get_classpath() {
195195
echo "${cp_path}"
196196
}
197197

198-
# Set process name if possible
199-
get_exec_args() {
200-
if [ "x${JAVA_APP_NAME}" != x ]; then
201-
echo "-a '${JAVA_APP_NAME}'"
202-
fi
203-
}
204-
205198
# Ensure that the running UID has the "jboss" passwd metadata
206199
# XXX: Maybe we should make this an entrypoint for the image?
207200
function configure_passwd() {
@@ -226,8 +219,11 @@ startup() {
226219
else
227220
args="-jar ${JAVA_APP_JAR}"
228221
fi
229-
log_info "exec $(get_exec_args) java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
230-
exec $(get_exec_args) java $(get_java_options) -cp "$(get_classpath)" ${args} $*
222+
223+
procname="${JAVA_APP_NAME-java}"
224+
225+
log_info "exec -a \"${procname}\" java $(get_java_options) -cp \"$(get_classpath)\" ${args} $*"
226+
exec -a "${procname}" java $(get_java_options) -cp "$(get_classpath)" ${args} $*
231227
}
232228

233229
# =============================================================================

0 commit comments

Comments
 (0)