summaryrefslogtreecommitdiff
path: root/portato/gui/gui_helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui/gui_helper.py')
-rw-r--r--portato/gui/gui_helper.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 7d8ead8..759752e 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -3,7 +3,7 @@
# File: portato/gui/gui_helper.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006 René 'Necoro' Neumann
+# Copyright (C) 2006-2007 René 'Necoro' Neumann
# This is free software. You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
@@ -26,6 +26,8 @@ from subprocess import Popen, PIPE, STDOUT
from threading import Thread
import pty
import time
+import os
+import signal
class Config:
"""Wrapper around a ConfigParser and for additional local configurations."""
@@ -469,10 +471,10 @@ class EmergeQueue:
self.console.set_pty(master)
# start emerge
- process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False)
+ self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False)
# start thread waiting for the stop of emerge
- Thread(name="Emerge-Thread", target=self._update_packages, args=(packages+self.deps.keys(), process)).start()
+ Thread(name="Emerge-Thread", target=self._update_packages, args=(packages+self.deps.keys(), self.process)).start()
# remove
for i in it:
@@ -555,6 +557,16 @@ class EmergeQueue:
else:
self._emerge([],[],[], command = command)
+ def kill_emerge (self):
+ """Kills the emerge process."""
+ try:
+ os.kill(self.process.pid, signal.SIGTERM)
+ debug("Process should be killed")
+ except AttributeError:
+ debug("AttributeError occured ==> process not exisiting - ignore")
+ except OSError:
+ debug("OSError occured ==> process already stopped - ignore")
+
def remove_with_children (self, it, removeNewFlags = True):
"""Convenience function which removes all children of an iterator and than the iterator itself.