Skip to content

Commit a899833

Browse files
authored
Merge pull request #11428 from dotty-staging/fix-script
Fix for java command in bin/scala
2 parents ffa59c8 + 672e69d commit a899833

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

dist/bin/scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ addJvmOptions () {
3131
jvm_options+=("'$1'")
3232
}
3333

34-
addDotcOptions () {
34+
addScalacOptions () {
3535
java_options+=("'$1'")
3636
}
3737

@@ -76,16 +76,16 @@ while [[ $# -gt 0 ]]; do
7676
shift
7777
;;
7878
@*|-color:*)
79-
addDotcOptions "${1}"
79+
addScalacOptions "${1}"
8080
shift
8181
;;
8282
-save|-savecompiled)
8383
save_compiled=true
84-
dotc_script_options+=("$1")
84+
scala_script_options+=("$1")
8585
shift
8686
;;
8787
-compile-only)
88-
dotc_script_options+=("$1")
88+
scala_script_options+=("$1")
8989
shift
9090
;;
9191
-d)
@@ -94,7 +94,7 @@ while [[ $# -gt 0 ]]; do
9494
;;
9595
-J*)
9696
addJvmOptions "${1:2}"
97-
addDotcOptions "${1}"
97+
addScalacOptions "${1}"
9898
shift ;;
9999
*)
100100
if [ $execute_script == false ]; then
@@ -119,11 +119,11 @@ if [ $execute_script == true ]; then
119119
if [ "$CLASS_PATH" ]; then
120120
cp_arg="-classpath \"$CLASS_PATH\""
121121
fi
122-
java_options+=(${dotc_script_options})
122+
java_options+=(${scala_script_options})
123123
setScriptName="-Dscript.path=$target_script"
124124
target_jar="${target_script%.*}.jar"
125125
if [[ $save_compiled == true && "$target_jar" -nt "$target_script" ]]; then
126-
java $setScriptName -jar "$target_jar" "${script_args[@]}"
126+
eval exec "\"$JAVACMD\"" $setScriptName -jar "$target_jar" "${script_args[@]}"
127127
else
128128
[[ $save_compiled == true ]] && rm -f $target_jar
129129
residual_args+=($setScriptName)

0 commit comments

Comments
 (0)