[PC-BSD Commits] r13704 - in pcbsd/current: src-qt4/pc-softwaremanager src-sh/pbi-manager

svn at pcbsd.org svn at pcbsd.org
Fri Nov 4 09:50:39 PDT 2011


Author: kris
Date: 2011-11-04 09:50:39 -0700 (Fri, 04 Nov 2011)
New Revision: 13704

Modified:
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
   pcbsd/current/src-sh/pbi-manager/pbi-manager
Log:

Fix issue with appcafe / pbi-manager, when we cancel a pbi_add or other process which is downloading, make sure the fetch process gets killed




Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-11-04 16:21:52 UTC (rev 13703)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-11-04 16:50:39 UTC (rev 13704)
@@ -165,8 +165,12 @@
         return false;
      } else {
         // Yep, ready to cancel, lets stop the download / update
-	if ( pbiJob )
-          pbiJob->kill();
+	if ( upgradePBIProc->state() == QProcess::Starting || upgradePBIProc->state() == QProcess::Running ) {
+          upgradePBIProc->terminate();
+	  upgradePBIProc->waitForFinished(1000);
+          upgradePBIProc->kill();
+	  upgradePBIProc->waitForFinished(1000);
+	}
         isWorkingOnPBI = true;
         return true;
      }

Modified: pcbsd/current/src-sh/pbi-manager/pbi-manager
===================================================================
--- pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-04 16:21:52 UTC (rev 13703)
+++ pcbsd/current/src-sh/pbi-manager/pbi-manager	2011-11-04 16:50:39 UTC (rev 13704)
@@ -5188,7 +5188,7 @@
 		rm "${PBI_TMPDIR}/.fetch-size.$$" 2>/dev/null
 
 		( fetch -o "${_lf}" "${_rf}" >/dev/null 2>/dev/null ; echo "$?" > ${_eFile} ) &
-		PID="$!"
+		FETCH_PID="$!"
 		while
 		z=1
 		do
@@ -5201,13 +5201,14 @@
 			fi
 
 			# Make sure download isn't finished
-			ps -p $PID >/dev/null 2>/dev/null
+			ps -p $FETCH_PID >/dev/null 2>/dev/null
 			if [ "$?" != "0" ] ; then break ; fi
 			sleep 2
 		done
 
 		_err="`cat ${_eFile}`"
 		if [ "$_err" = "0" ]; then echo "FETCHDONE" ; fi
+		unset FETCH_PID
 	fi
 
 	echo ""
@@ -6342,6 +6343,10 @@
 
 # Cleanup after caught exit
 exit_trap() {
+	# If a download is running, kill it
+	if [ ! -z "${FETCH_PID}" ] ; then 
+	   kill -9 ${FETCH_PID}
+	fi
 	rm_tmpdir
 	exit 0
 }



More information about the Commits mailing list