test/com/sun/tools/attach/ApplicationSetup.sh

Print this page

        

@@ -47,19 +47,23 @@
   # ${pid} is not the actual pid. We have put in a small sleep
   # to give the intermediate shell process time to launch the
   # "java" process.
   if [ "$OS" = "Windows" ]; then
     sleep 2
+    if [ "${isCygwin}" = "true" ] ; then
+      realpid=`ps -p ${pid} | tail -1 | awk '{print $4;}'`
+    else
     realpid=`ps -o pid,ppid,comm|grep ${pid}|grep "java"|cut -c1-6`
+    fi
     pid=${realpid}
   fi
                                                                                                                   
   echo "Waiting for Application to initialize..."
   attempts=0
   while true; do
     sleep 1
-    port=`tail -1 ${OUTPUTFILE}`
+    port=`tail -1 ${OUTPUTFILE} | sed -e 's@\\r@@g' `
     if [ ! -z "$port" ]; then
       # In case of errors wait time for output to be flushed
       sleep 1
       cat ${OUTPUTFILE}
       break