diff --git a/as.sh b/as.sh index ca87e7df5..763e5e570 100755 --- a/as.sh +++ b/as.sh @@ -8,10 +8,10 @@ # program : Arthas # author : Core Engine @ Taobao.com -# date : 2018-11-19 +# date : 2018-11-23 # current arthas script version -ARTHAS_SCRIPT_VERSION=3.0.4.2 +ARTHAS_SCRIPT_VERSION=3.0.4.3 # define arthas's home ARTHAS_HOME=${HOME}/.arthas @@ -488,10 +488,14 @@ attach_jvm() echo "Attaching to ${TARGET_PID} using version ${1}..." - local opts="${ARTHAS_OPTS} ${BOOT_CLASSPATH} ${JVM_OPTS}" + local java_command=("${JAVA_HOME}"/bin/java) + if [ "${BOOT_CLASSPATH}" ]; then + java_command+=("${BOOT_CLASSPATH}") + fi + if [ ${TARGET_IP} = ${DEFAULT_TARGET_IP} ]; then - "${JAVA_HOME}"/bin/java \ - ${opts} \ + "${java_command[@]}" \ + ${ARTHAS_OPTS} ${JVM_OPTS} \ -jar "${arthas_lib_dir}/arthas-core.jar" \ -pid ${TARGET_PID} \ -target-ip ${TARGET_IP} \