groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch GROOVY_2_5_X updated: GROOVY-9040: fix shellcheck warnings in bootstrap scripts (closes #896)
Date Mon, 18 Mar 2019 01:29:09 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new 5dd4128  GROOVY-9040: fix shellcheck warnings in bootstrap scripts (closes #896)
5dd4128 is described below

commit 5dd4128f720bf7deae84928cb89273c86a18e990
Author: Dylan Cali <calid1984@gmail.com>
AuthorDate: Tue Mar 12 16:02:35 2019 -0400

    GROOVY-9040: fix shellcheck warnings in bootstrap scripts (closes #896)
    
    most are common gotchas like lack of variable quoting, using deprecated
    constructs like '``' instead of '$()', not exporting env vars used in
    child scripts, and using non-portable operators like '-a' and '-o' in
    conditionals
    
    some specific items to note in startGroovy:
      * ulimit -H -n is technically not portable as POSIX ulimit only
        supports -f.  however there is no clean POSIX-y alternative and after
        researching pretty much every shell on every *nix implements these
        options, so I've simply added a comment that suppresses this warning
    
      * the logic to munge arguments on cygwin was unecessarily commplex
        (and not portable). i've replaced this with a far simpler solution
        that builds up the munged arguments string dynamically then uses eval
        to invoke set and override the positional parameters
    
      * the final java invocation did 'eval exec' which is unecessary and a
        little nonsensical. directly using exec along with standard variable
        interpolation should suffice. however since we _do_ want word
        splitting on the JAVA_OPTS argument we disable the double quote
        warning here
    
    a complete dump of all the warnings shellcheck reported can be found
    here: https://gist.github.com/calid/634258c25f9d4aa0c1327eff1c5b16e1
---
 src/bin/grape         |  10 ++--
 src/bin/groovy        |  10 ++--
 src/bin/groovyConsole |  10 ++--
 src/bin/groovyc       |  10 ++--
 src/bin/groovydoc     |  10 ++--
 src/bin/groovysh      |  10 ++--
 src/bin/java2groovy   |  10 ++--
 src/bin/startGroovy   | 157 ++++++++++++++++++++++----------------------------
 8 files changed, 105 insertions(+), 122 deletions(-)

diff --git a/src/bin/grape b/src/bin/grape
index 43ba5bf..0a5878b 100644
--- a/src/bin/grape
+++ b/src/bin/grape
@@ -26,22 +26,22 @@
 ##                                                                          ##
 ##############################################################################
 
-GROOVY_APP_NAME=Grape
+export GROOVY_APP_NAME=Grape
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/groovy b/src/bin/groovy
index c2d29d1..3ecca63 100644
--- a/src/bin/groovy
+++ b/src/bin/groovy
@@ -26,22 +26,22 @@
 ##                                                                          ##
 ##############################################################################
 
-GROOVY_APP_NAME=Groovy
+export GROOVY_APP_NAME=Groovy
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/groovyConsole b/src/bin/groovyConsole
index 2c1b8f1..48201d8 100644
--- a/src/bin/groovyConsole
+++ b/src/bin/groovyConsole
@@ -24,22 +24,22 @@
 ##                                                                          ##
 ##############################################################################
 
-GROOVY_APP_NAME=GroovyConsole
+export GROOVY_APP_NAME=GroovyConsole
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/groovyc b/src/bin/groovyc
index 6f09c2e..b224f3f 100644
--- a/src/bin/groovyc
+++ b/src/bin/groovyc
@@ -24,22 +24,22 @@
 ##                                                                          ##
 ##############################################################################
 
-GROOVY_APP_NAME=GroovyC
+export GROOVY_APP_NAME=GroovyC
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/groovydoc b/src/bin/groovydoc
index b26c01e..094ac0e 100644
--- a/src/bin/groovydoc
+++ b/src/bin/groovydoc
@@ -24,22 +24,22 @@
 ##                                                                          ##
 ##############################################################################
 
-GROOVY_APP_NAME=GroovyDoc
+export GROOVY_APP_NAME=GroovyDoc
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/groovysh b/src/bin/groovysh
index 9c56342..cfd558d 100644
--- a/src/bin/groovysh
+++ b/src/bin/groovysh
@@ -24,22 +24,22 @@
 ##                                                                          ##
 ##############################################################################
 
-GROOVY_APP_NAME=GroovyShell
+export GROOVY_APP_NAME=GroovyShell
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/java2groovy b/src/bin/java2groovy
index 0fa155e..c480193 100644
--- a/src/bin/java2groovy
+++ b/src/bin/java2groovy
@@ -29,22 +29,22 @@
 ## $Date: 2006-11-16 17:30:40 +0000 (Thu, 16 Nov 2006) $
 ##
 
-GROOVY_APP_NAME=Java2Groovy
+export GROOVY_APP_NAME=Java2Groovy
 
 # resolve links - $0 may be a soft-link
 PRG="$0"
 
 while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
+    ls="$(ls -ld "$PRG")"
+    link="$(expr "$ls" : '.*-> \(.*\)$')"
     if expr "$link" : '/.*' > /dev/null; then
         PRG="$link"
     else
-        PRG=`dirname "$PRG"`/"$link"
+        PRG="$(dirname "$PRG")"/"$link"
     fi
 done
 
-DIRNAME=`dirname "$PRG"`
+DIRNAME="$(dirname "$PRG")"
 
 . "$DIRNAME/startGroovy"
 
diff --git a/src/bin/startGroovy b/src/bin/startGroovy
index 31da4aa..175690b 100644
--- a/src/bin/startGroovy
+++ b/src/bin/startGroovy
@@ -25,9 +25,7 @@
 ##                                                                          ##
 ##############################################################################
 
-PROGNAME=`basename "$0"`
-
-#DIRNAME=`dirname "$0"`
+PROGNAME="$(basename "$0")"
 
 SCRIPT_PATH="$0"
 
@@ -63,7 +61,7 @@ cygwin=false
 msys=false
 darwin=false
 nonstop=false
-case "`uname`" in
+case "$(uname)" in
   CYGWIN* )
     cygwin=true
     ;; 
@@ -78,7 +76,7 @@ case "`uname`" in
     ;;
 esac
 
-if [ "$1" = "-cp" -o "$1" = "-classpath" -o "$1" = "--classpath" ] ; then
+if [ "$1" = "-cp" ] || [ "$1" = "-classpath" ] || [ "$1" = "--classpath" ] ; then
     CP=$2
     shift 2
 fi
@@ -86,59 +84,59 @@ fi
 # Attempt to set JAVA_HOME if it's not already set.
 if [ -z "$JAVA_HOME" ] ; then
     if $darwin ; then 
-        [ -z "$JAVA_HOME" -a -f "/usr/libexec/java_home" ] && export JAVA_HOME=`/usr/libexec/java_home`
-        [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
-        [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] &&
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
+        [ -z "$JAVA_HOME" ] && [ -f "/usr/libexec/java_home" ] && JAVA_HOME="$(/usr/libexec/java_home)"
+        [ -z "$JAVA_HOME" ] && [ -d "/Library/Java/Home" ] && JAVA_HOME="/Library/Java/Home"
+        [ -z "$JAVA_HOME" ] && [ -d "/System/Library/Frameworks/JavaVM.framework/Home"
] && JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
     else
-        javaExecutable="`which javac`"
-        [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] &&
die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
+        javaExecutable="$(which javac)"
+        [ -z "$javaExecutable" ] || [ "$(expr "$javaExecutable" : '\([^ ]*\)')" = "no" ]
&& die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
         # readlink(1) is not available as standard on Solaris 10.
-        readLink=`which readlink`
-        [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and
readlink not available, please set JAVA_HOME."
-        javaExecutable="`readlink -f \"$javaExecutable\"`"
-        javaHome="`dirname \"$javaExecutable\"`"
-        javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+        readLink="$(which readlink)"
+        [ "$(expr "$readLink" : '\([^ ]*\)')" = "no" ] && die "JAVA_HOME not set
and readlink not available, please set JAVA_HOME."
+        javaExecutable="$(readlink -f "$javaExecutable")"
+        javaHome="$(dirname "$javaExecutable")"
+        javaHome="$(expr "$javaHome" : '\(.*\)/bin')"
         JAVA_HOME="$javaHome"
-        export JAVA_HOME
-
     fi
+
+    export JAVA_HOME
 fi
 
 # For Cygwin, ensure paths are in UNIX format before anything is touched.
 if $cygwin ; then
-    [ -n "$GROOVY_HOME" ] && GROOVY_HOME=`cygpath --unix "$GROOVY_HOME"`
-    [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
-    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-    [ -n "$CP" ] && CP=`cygpath --path --unix "$CP"`
+    [ -n "$GROOVY_HOME" ] && GROOVY_HOME="$(cygpath --unix "$GROOVY_HOME")"
+    [ -n "$JAVACMD" ] && JAVACMD="$(cygpath --unix "$JAVACMD")"
+    [ -n "$JAVA_HOME" ] && JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
+    [ -n "$CP" ] && CP=$(cygpath --path --unix "$CP")
 else
-    if [ -n "$GROOVY_HOME" -a "`expr "$GROOVY_HOME":'\/$'`" ] ; then
-        GROOVY_HOME=`echo $GROOVY_HOME | sed -e 's/\/$//'`
+    if [ -n "$GROOVY_HOME" ] && [ "$(expr "$GROOVY_HOME" : '\/$')" ] ; then
+        GROOVY_HOME="$(echo "$GROOVY_HOME" | sed -e 's/\/$//')"
     fi
 fi
 
 #  For MSYS, ensure paths are in appropriate format.
 if $msys
 then
-    [ -n "$JAVA_HOME" ] && JAVA_HOME=`( cd "$JAVA_HOME" ; pwd )`
+    [ -n "$JAVA_HOME" ] && JAVA_HOME="$(cd "$JAVA_HOME" ; pwd)"
 fi
 
 # Attempt to set GROOVY_HOME if it is not already set.
-if [ -z "$GROOVY_HOME" -o ! -d "$GROOVY_HOME" ] ; then
+if [ -z "$GROOVY_HOME" ] || [ ! -d "$GROOVY_HOME" ] ; then
     # Resolve links: $0 may be a link to groovy's home.
     PRG="$0"
     # Need this for relative symlinks.
     while [ -h "$PRG" ] ; do
-        ls=`ls -ld "$PRG"`
-        link=`expr "$ls" : '.*-> \(.*\)$'`
+        ls="$(ls -ld "$PRG")"
+        link="$(expr "$ls" : '.*-> \(.*\)$')"
         if expr "$link" : '/.*' > /dev/null; then
             PRG="$link"
         else
-            PRG=`dirname "$PRG"`"/$link"
+            PRG="$(dirname "$PRG")""/$link"
         fi
     done
-    SAVED="`pwd`"
-    cd "`dirname \"$PRG\"`/.."
-    GROOVY_HOME="`pwd -P`"
+    SAVED="$(pwd)"
+    cd "$(dirname "$PRG")/.."
+    GROOVY_HOME="$(pwd -P)"
     cd "$SAVED"
 fi
 
@@ -179,13 +177,17 @@ if [ -z "$JAVA_HOME" ] ; then
 fi
 
 # Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
-    MAX_FD_LIMIT=`ulimit -H -n`
+if [ "$cygwin" = "false" ] && [ "$darwin" = "false" ] && [ "$nonstop" = "false"
] ; then
+    # disable ulimit shellcheck warnings. while only ulimit -f is technicaly
+    # POSIX correct virtually every shell on every *nix supports these options
+    # shellcheck disable=SC2039
+    MAX_FD_LIMIT="$(ulimit -H -n)"
     if [ $? -eq 0 ] ; then
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+        if [ "$MAX_FD" = "maximum" ] || [ "$MAX_FD" = "max" ] ; then
             MAX_FD="$MAX_FD_LIMIT"
         fi
-        ulimit -n $MAX_FD
+        # shellcheck disable=SC2039
+        ulimit -n "$MAX_FD"
         if [ $? -ne 0 ] ; then
             warn "Could not set maximum file descriptor limit: $MAX_FD"
         fi
@@ -198,7 +200,7 @@ fi
 useprofiler=false
 if [ "$PROFILER" != "" ] ; then
     if [ -r "$PROFILER" ] ; then
-        . $PROFILER
+        . "$PROFILER"
         useprofiler=true
     else
         die "Profiler file not found: $PROFILER"
@@ -212,21 +214,21 @@ TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
 #fi
 
 # For Darwin, add GROOVY_APP_NAME to the JAVA_OPTS as -Xdock:name
-if $darwin; then
+if "$darwin"; then
     JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GROOVY_APP_NAME -Xdock:icon=$GROOVY_HOME/lib/groovy.icns"
 fi
 
 # For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
-    GROOVY_HOME=`cygpath --mixed "$GROOVY_HOME"`
-    JAVA_HOME=`cygpath --mixed "$JAVA_HOME"`
-    GROOVY_CONF=`cygpath --mixed "$GROOVY_CONF"`
-    CP=`cygpath --path --mixed "$CP"`    
-    TOOLS_JAR=`cygpath --mixed "$TOOLS_JAR"`
-    STARTER_CLASSPATH=`cygpath --path --mixed "$STARTER_CLASSPATH"`
+if "$cygwin"; then
+    GROOVY_HOME="$(cygpath --mixed "$GROOVY_HOME")"
+    JAVA_HOME="$(cygpath --mixed "$JAVA_HOME")"
+    GROOVY_CONF="$(cygpath --mixed "$GROOVY_CONF")"
+    CP="$(cygpath --path --mixed "$CP")"
+    TOOLS_JAR="$(cygpath --mixed "$TOOLS_JAR")"
+    STARTER_CLASSPATH="$(cygpath --path --mixed "$STARTER_CLASSPATH")"
 
     # We build the pattern for arguments to be converted via cygpath
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    ROOTDIRSRAW="$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null)"
     SEP=""
     for dir in $ROOTDIRSRAW ; do
         ROOTDIRS="$ROOTDIRS$SEP$dir"
@@ -238,43 +240,23 @@ if $cygwin ; then
         OURCYGPATTERN="$OURCYGPATTERN|($GROOVY_CYGPATTERN)"
     fi
     # Now convert the arguments - kludge to limit ourselves to /bin/sh
-    i=0
+    argsstr=''
     for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        if [ $CHECK -ne 0 ] ; then
-            patched=`cygpath --path --ignore --mixed "$arg"`
+        CHECK="$(echo "$arg"|egrep -c "$OURCYGPATTERN" -)"
+        if [ "$CHECK" -ne 0 ] ; then
+            patched="$(cygpath --path --ignore --mixed "$arg")"
         else
             patched="$arg"
         fi
-        if [ x"$BASH" = x ]; then
-            eval `echo args$i`="\"$arg\""
-        else
-            args[$i]="$patched"
-        fi
-        i=`expr $i + 1`
+        argsstr="$argsstr \"$patched\""
     done
 
-    if [ x"$BASH" = x ]; then
-        case $i in
-            0) set -- ;;
-            1) set -- "$args0" ;;
-            2) set -- "$args0" "$args1" ;;
-            3) set -- "$args0" "$args1" "$args2" ;;
-            4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-            5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-            6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-            7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-            8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7"
;;
-            9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7"
"$args8" ;;
-        esac
-    else
-        set -- "${args[@]}"
-    fi
+    eval "set -- $argsstr"
 fi
 
 startGroovy ( ) {
-    JAVA_VERSION=`"$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut
-d "_" -f1`
-    if [ "$JAVA_VERSION" \> "1.8.0" ]; then
+    JAVA_VERSION="$("$JAVACMD" -version 2>&1 | awk -F '"' '/version/ {print $2}' |
cut -d "_" -f1)"
+    if [ "$(expr "$JAVA_VERSION" \> "1.8.0")" ]; then
     		JAVA_OPTS="$JAVA_OPTS -Dgroovy.jaxb=jaxb"
     		[ "$GROOVY_TURN_OFF_JAVA_WARNINGS" = "true" ] &&       JAVA_OPTS="$JAVA_OPTS
--add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.annotation=ALL-UNNAMED
--add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.module=ALL-UNNAMED
--add-opens=java.base/java.lang.ref=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/ [...]
             # sun.awt.windows just on windows platforms
@@ -283,24 +265,25 @@ startGroovy ( ) {
             fi
     fi
 
-    CLASS=$1
+    CLASS="$1"
     shift
     # Start the Profiler or the JVM
-    if $useprofiler ; then
+    if [ "$useprofiler" = true ] ; then
         runProfiler
     else
-        eval exec "\"\$JAVACMD\"" $JAVA_OPTS \
-            -classpath "\"\$STARTER_CLASSPATH\"" \
-            -Dscript.name="\"\$SCRIPT_PATH\"" \
-            -Dprogram.name="\"\$PROGNAME\"" \
-            -Dgroovy.starter.conf="\"\$GROOVY_CONF\"" \
-            -Dgroovy.home="\"\$GROOVY_HOME\"" \
-            -Dtools.jar="\"\$TOOLS_JAR\"" \
-            $STARTER_MAIN_CLASS \
-            --main $CLASS \
-            --conf "\"\$GROOVY_CONF\"" \
-            --classpath "\"\$CP\"" \
-            "\"\$@\""
+        # shellcheck disable=SC2086
+        exec "$JAVACMD" $JAVA_OPTS \
+            -classpath "$STARTER_CLASSPATH" \
+            -Dscript.name="$SCRIPT_PATH" \
+            -Dprogram.name="$PROGNAME" \
+            -Dgroovy.starter.conf="$GROOVY_CONF" \
+            -Dgroovy.home="$GROOVY_HOME" \
+            -Dtools.jar="$TOOLS_JAR" \
+            "$STARTER_MAIN_CLASS" \
+            --main "$CLASS" \
+            --conf "$GROOVY_CONF" \
+            --classpath "$CP" \
+            "$@"
     fi
 }
 


Mime
View raw message