Bug 477724 avoid pointless shell interpreter hanging around r=bsmedberg
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 21 Aug 2009 10:09:54 +1200
changeset 31711 9ab3645be5aaaa10f61a8a535e6a65117b53216b
parent 31710 94b80058051b554853dd229cb12fa3b82981a2e4
child 31712 30a01dc450d7778f09be8c186d75ecc2f3452f25
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbsmedberg
bugs477724
milestone1.9.3a1pre
Bug 477724 avoid pointless shell interpreter hanging around r=bsmedberg
build/unix/mozilla.in
build/unix/run-mozilla.sh
--- a/build/unix/mozilla.in
+++ b/build/unix/mozilla.in
@@ -131,13 +131,10 @@ do
       ;;
   esac
 done
 
 if [ $debugging = 1 ]
 then
   echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
 fi
-"$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
-exitcode=$?
-
-exit $exitcode
+exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
 # EOF.
--- a/build/unix/run-mozilla.sh
+++ b/build/unix/run-mozilla.sh
@@ -37,17 +37,17 @@
 # ***** END LICENSE BLOCK *****
 cmdname=`basename "$0"`
 MOZ_DIST_BIN=`dirname "$0"`
 MOZ_DEFAULT_NAME="./${cmdname}-bin"
 MOZ_APPRUNNER_NAME="./mozilla-bin"
 MOZ_VIEWER_NAME="./viewer"
 MOZ_PROGRAM=""
 
-exitcode=0
+exitcode=1
 #
 ##
 ## Functions
 ##
 ##########################################################################
 moz_usage()
 {
 echo "Usage:  ${cmdname} [options] [program]"
@@ -135,17 +135,17 @@ moz_run_program()
 	##
 	if [ ! -x "$prog" ]
 	then
 		moz_bail "Cannot execute $prog."
 	fi
 	##
 	## Run the program
 	##
-	"$prog" ${1+"$@"}
+	exec "$prog" ${1+"$@"}
 	exitcode=$?
 }
 ##########################################################################
 moz_debug_program()
 {
 	prog=$MOZ_PROGRAM
 	##
 	## Make sure the program is executable
@@ -163,43 +163,34 @@ moz_debug_program()
 		else
 			debugger=`LC_MESSAGES=C type $moz_debugger | awk '{print $3;}' | sed -e 's/\.$//'` 
 		fi	
 	else
 		debugger=`moz_get_debugger`
 	fi
     if [ -x "$debugger" ] 
     then
-        tmpfile=`mktemp /tmp/mozargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
-        trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
-        # echo -n isn't portable, so pipe through perl -pe chomp instead
-        echo "set args" | perl -pe 'chomp' > $tmpfile
-        for PARAM in "$@"
-        do
-            echo " '$PARAM'" | perl -pe 'chomp' >> $tmpfile
-        done
-        echo >> $tmpfile
 # If you are not using ddd, gdb and know of a way to convey the arguments 
 # over to the prog then add that here- Gagan Saksena 03/15/00
         case `basename $debugger` in
-            gdb) echo "$debugger $prog -x $tmpfile"
-                $debugger "$prog" -x $tmpfile
+            gdb) echo "$debugger --args $prog" ${1+"$@"}
+                exec "$debugger" --args "$prog" ${1+"$@"}
 		exitcode=$?
                 ;;
-            ddd) echo "$debugger --debugger \"gdb -x $tmpfile\" $prog"
-                $debugger --debugger "gdb -x $tmpfile" "$prog"
+            ddd) echo "$debugger --gdb -- --args $prog" ${1+"$@"}
+		exec "$debugger" --gdb -- --args "$prog" ${1+"$@"}
 		exitcode=$?
                 ;;
             *) echo "$debugger $prog ${1+"$@"}"
-                $debugger "$prog" ${1+"$@"}
+                exec $debugger "$prog" ${1+"$@"}
 		exitcode=$?
                 ;;
         esac
     else
-        echo "Could not find a debugger on your system." 
+        moz_bail "Could not find a debugger on your system."
     fi
 }
 ##########################################################################
 ##
 ## Command line arg defaults
 ##
 moz_debug=0
 moz_debugger=""