[PC-BSD Commits] r14046 - pcbsd/current/src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Mon Nov 28 10:39:06 PST 2011


Author: kris
Date: 2011-11-28 10:39:06 -0800 (Mon, 28 Nov 2011)
New Revision: 14046

Modified:
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Fix a bug in pbi-manager, make sure we kill the fetch and delete the tmp file when bailing on a download




Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-28 17:10:23 UTC (rev 14045)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-28 18:39:06 UTC (rev 14046)
@@ -5201,7 +5201,8 @@
 		rm "${PBI_TMPDIR}/.fetch-size.$$" 2>/dev/null
 
 		( fetch -a -o "${_lf}" "${_rf}" >/dev/null 2>/dev/null ; echo "$?" > ${_eFile} ) &
-		FETCH_PID="$!"
+		FETCH_PID=`ps -auwwwx | grep -v grep | grep "fetch -a -o ${_lf}" | awk '{print $2}'`
+		FETCH_TFILE="${_lf}"
 		while
 		z=1
 		do
@@ -5221,7 +5222,7 @@
 
 		_err="`cat ${_eFile}`"
 		if [ "$_err" = "0" ]; then echo "FETCHDONE" ; fi
-		unset FETCH_PID
+		unset FETCH_PID FETCH_TFILE
 	fi
 
 	echo ""
@@ -6384,7 +6385,10 @@
 exit_trap() {
 	# If a download is running, kill it
 	if [ ! -z "${FETCH_PID}" ] ; then 
+	   echo "Killing ${FETCH_PID}"
 	   kill -9 ${FETCH_PID}
+	   sleep 1
+	   rm ${FETCH_TFILE}
 	fi
 	rm_tmpdir
 	exit 0
@@ -6461,7 +6465,7 @@
 mk_required_dirs
 load_pbi_etcconf
 
-trap exit_trap 1 2 3 15
+trap exit_trap 1 2 3 9 15
 
 # Figure out which mode we are running in
 case `basename ${0}` in



More information about the Commits mailing list