@@ -244,12 +244,13 @@ if [ -r "/dev/urandom" ]; then
244244 JAVA_SECURITY_EGD=" file:/dev/urandom"
245245fi
246246
247- # Gather environment information as we go
248- readonly cr ='
247+ cr= " $( printf ' \r ' ) " && readonly cr
248+ readonly nl ='
249249'
250+ # Gather environment information as we go
250251environment_log=" "
251252add_log () {
252- environment_log=" ${environment_log}${cr }${* -} "
253+ environment_log=" ${environment_log}${nl }${* -} "
253254}
254255
255256# Logic to process "arguments files" on both Java 8 and Java 9+
@@ -265,7 +266,7 @@ process_java_opts() {
265266 append java_opts_from_files " @$java_opts_file "
266267 else
267268 local line=
268- while read -r line; do
269+ while IFS= " $cr " read -r line; do
269270 if [ " $line " ]; then
270271 # shellcheck disable=2086 # Split options on whitespace
271272 append java_opts_from_files $line
@@ -533,7 +534,7 @@ java_major=8
533534# shellcheck source=/dev/null
534535if [ -f " $JAVA_HOME /release" ]; then
535536 # Get java version from JAVA_HOME/release file
536- while IFS= read -r line; do
537+ while IFS=" $cr " read -r line; do
537538 case $line in
538539 (\# * ) continue ;;
539540 esac
573574# Default java_runtime_version to $java_version
574575: " ${java_runtime_version:= $java_version } "
575576
576- add_log " Detected Java version: $java_version "
577+ add_log " Detected Java version: $java_version (major: $java_major ) "
577578add_log " Detected Java runtime version: $java_runtime_version "
579+ add_log " Detected JRuby minimum java version: $minimum_java_version "
578580
579581# Present a useful error if running a Java version lower than bin/.java-version
580582if [ " $java_major " -lt " $minimum_java_version " ]; then
@@ -1010,7 +1012,7 @@ add_log " $*"
10101012
10111013# shellcheck source=/dev/null
10121014if $print_environment_log ; then
1013- environment_log=" JRuby Environment${cr } =================${cr }${cr } JRuby version: ${jruby_version}${environment_log} "
1015+ environment_log=" JRuby Environment${nl } =================${nl }${nl } JRuby version: ${jruby_version}${environment_log} "
10141016 echo " $environment_log "
10151017 exit 0
10161018fi
0 commit comments