summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
authornecoro <>2007-08-12 07:00:15 +0000
committernecoro <>2007-08-12 07:00:15 +0000
commitd24ac86bd4ef4f96c8298499d5b0789731a32a33 (patch)
treea9af458fa4b00f78c77ee5b8ed8e6c95e81f8ce3 /portato
parent2a2d20986595f2b575e5bb371e9db026102466ba (diff)
downloadportato-d24ac86bd4ef4f96c8298499d5b0789731a32a33.tar.gz
portato-d24ac86bd4ef4f96c8298499d5b0789731a32a33.tar.bz2
portato-d24ac86bd4ef4f96c8298499d5b0789731a32a33.zip
made emerge pausing work (again?)
Diffstat (limited to '')
-rwxr-xr-xportato.py6
-rw-r--r--portato/gui/gui_helper.py15
2 files changed, 9 insertions, 12 deletions
diff --git a/portato.py b/portato.py
index 7f5308c..646e850 100755
--- a/portato.py
+++ b/portato.py
@@ -89,12 +89,6 @@ def main ():
print _("Validation succeeded.")
return
elif options.nolistener:
- try:
- # move this process into a new process group
- # this is to be able to kill emerge et al w/o killing ourselves :)
- os.setsid()
- except OSError:
- pass
listener.set_send()
run()
else: # start listener and start us again in root modus
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index ebe0bcf..507fa41 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -476,7 +476,7 @@ class EmergeQueue:
self.console.set_pty(master)
# start emerge
- self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False, env = system.get_environment())
+ self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False, env = system.get_environment(), preexec_fn = os.setsid)
# remove packages from queue
for i in it:
@@ -610,8 +610,12 @@ class EmergeQueue:
if self.process is not None:
self.threadQueue.clear() # remove all pending emerge threads
try:
- send_signal_to_group(signal.SIGTERM)
- debug("Process should be killed")
+ pgid = os.getpgid(self.process.pid)
+ os.killpg(pgid, signal.SIGTERM)
+ debug("Process should be terminated")
+ if self.process.poll() is None:
+ os.killpg(pgid, signal.SIGKILL)
+ debug("Process should be killed")
except AttributeError:
debug("AttributeError occured ==> process not exisiting - ignore")
except OSError:
@@ -621,13 +625,12 @@ class EmergeQueue:
def stop_emerge (self):
if self.process is not None:
- # use SIGTSTP in favor of SIGSTOP, as SIGSTOP cannot be blocked and would stop the GUI too
- send_signal_to_group(signal.SIGTSTP)
+ os.killpg(os.getpgid(self.process.pid), signal.SIGSTOP)
debug("Process should be stopped")
def continue_emerge (self):
if self.process is not None:
- send_signal_to_group(signal.SIGCONT)
+ os.killpg(os.getpgid(self.process.pid), signal.SIGCONT)
debug("Process should continue")
def remove_with_children (self, it, removeNewFlags = True):