costin 2002/08/08 10:07:48
Modified: src/script ant antRun
Log:
Submited the patch from Patrick.
1. Removes the extraneous "cd `dirname $PRG`" line that causes the
script to break when Ant is invoked with from a relative path
(i.e. ../jakarta-ant/bin/ant).
2. Properly quote all environment variables that may contain paths.
The script would break if any of these environment variables
contained paths with spaces in them (a common occurrence on Windows).
3. Invoke Java using the "exec" shell command. There really is no need
to create a child process to run the JVM and by using the "exec"
command, there is less chance that killing the script will fail to
kill Ant.
Submitted by: Patrick Luby <[EMAIL PROTECTED]>
Revision Changes Path
1.24 +15 -18 jakarta-ant/src/script/ant
Index: ant
===================================================================
RCS file: /home/cvs/jakarta-ant/src/script/ant,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ant 12 Jul 2002 15:15:46 -0000 1.23
+++ ant 8 Aug 2002 17:07:48 -0000 1.24
@@ -44,20 +44,18 @@
fi
## resolve links - $0 may be a link to ant's home
- PRG=$0
- progname=`basename $0`
+ PRG="$0"
+ progname=`basename "$0"`
saveddir=`pwd`
# need this for relative symlinks
- cd `dirname $PRG`
-
while [ -h "$PRG" ] ; do
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
@@ -80,7 +78,7 @@
fi
# set ANT_LIB location
-ANT_LIB=${ANT_HOME}/lib
+ANT_LIB="${ANT_HOME}/lib"
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
@@ -107,18 +105,18 @@
# in rpm_mode get ant/optional/xml parser&api from JAVALIBDIR
if $rpm_mode; then
- JAVALIBDIR=/usr/share/java
+ JAVALIBDIR="/usr/share/java"
for i in ant ant-optional jaxp_parser xml_apis
do
if [ -z "$LOCALCLASSPATH" ] ; then
- LOCALCLASSPATH=$JAVALIBDIR/$i.jar
+ LOCALCLASSPATH="$JAVALIBDIR/$i.jar"
else
- LOCALCLASSPATH="$JAVALIBDIR/$i.jar":"$LOCALCLASSPATH"
+ LOCALCLASSPATH="$JAVALIBDIR/$i.jar:$LOCALCLASSPATH"
fi
done
# in rpm mode ant/lib is in /usr/share/java/ant
-ANT_LIB=${JAVALIBDIR}/ant
+ANT_LIB="${JAVALIBDIR}/ant"
fi
@@ -127,11 +125,11 @@
do
# if the directory is empty, then it will return the input string
# this is stupid, so case for it
- if [ "$i" != "${ANT_LIB}/*.jar" ] ; then
+ if [ -f "$i" ] ; then
if [ -z "$LOCALCLASSPATH" ] ; then
- LOCALCLASSPATH=$i
+ LOCALCLASSPATH="$i"
else
- LOCALCLASSPATH="$i":"$LOCALCLASSPATH"
+ LOCALCLASSPATH="$i:$LOCALCLASSPATH"
fi
fi
done
@@ -148,10 +146,10 @@
# OSX hack to make Ant work with jikes
if $darwin ; then
OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
- if [ -d ${OSXHACK} ] ; then
- for i in ${OSXHACK}/*.jar
+ if [ -d "${OSXHACK}" ] ; then
+ for i in "${OSXHACK}"/*.jar
do
- JIKESPATH=$JIKESPATH:$i
+ JIKESPATH="$JIKESPATH:$i"
done
fi
fi
@@ -167,7 +165,6 @@
if $cygwin ; then
JIKESPATH=`cygpath --path --windows "$JIKESPATH"`
fi
- ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
fi
# Allow Jikes support (off by default)
@@ -184,4 +181,4 @@
ANT_OPTS="$ANT_OPTS -Dcygwin.user.home="`cygpath --path --windows "$HOME"`
fi
-"$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" $ANT_OPTS
org.apache.tools.ant.Main $ANT_ARGS "$@"
+exec "$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}"
-Djikes.class.path="$JIKESPATH" $ANT_OPTS org.apache.tools.ant.Main $ANT_ARGS
"$@"
1.3 +1 -1 jakarta-ant/src/script/antRun
Index: antRun
===================================================================
RCS file: /home/cvs/jakarta-ant/src/script/antRun,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- antRun 10 Jan 2002 14:18:42 -0000 1.2
+++ antRun 8 Aug 2002 17:07:48 -0000 1.3
@@ -9,4 +9,4 @@
shift
shift
-exec $CMD "$@"
+exec "$CMD" "$@"
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>