[jhbuild: 18/60] [gui] kill build process on window close
- From: Frederic Peters <fpeters src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild: 18/60] [gui] kill build process on window close
- Date: Sat, 6 Jun 2009 09:49:07 -0400 (EDT)
commit 9aa8358c7078ff6f129683b51f2343f01aed7874
Author: Frédéric Péters <fpeters 0d be>
Date: Sun May 17 00:28:47 2009 +0200
[gui] kill build process on window close
---
jhbuild/frontends/gtkui.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/jhbuild/frontends/gtkui.py b/jhbuild/frontends/gtkui.py
index 5437e7e..a4bd19b 100644
--- a/jhbuild/frontends/gtkui.py
+++ b/jhbuild/frontends/gtkui.py
@@ -53,6 +53,7 @@ from terminal import t_bold, t_reset
class AppWindow(gtk.Window, buildscript.BuildScript):
default_module_iter = None
active_iter = None
+ child_pid = None
def __init__(self, config):
buildscript.BuildScript.__init__(self, config)
@@ -97,6 +98,8 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
def on_delete_event(self, *args):
gtk.main_quit()
+ if self.child_pid:
+ os.kill(self.child_pid, signal.SIGKILL)
sys.exit(0)
def create_ui(self):
@@ -243,6 +246,7 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
p = subprocess.Popen(command, **kws)
except OSError, e:
raise CommandError(str(e))
+ self.child_pid = p.pid
p.stdin.close()
@@ -287,7 +291,9 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
time.sleep(0.05)
- return p.wait()
+ rc = p.wait()
+ self.child_pid = None
+ return rc
else:
# use the vte widget
if isinstance(command, (str, unicode)):
@@ -302,10 +308,11 @@ class AppWindow(gtk.Window, buildscript.BuildScript):
env.update(extra_env)
self.vte_fork_running = True
- pid = self.terminal.fork_command(command=command[0], argv=command,
+ self.child_pid = self.terminal.fork_command(command=command[0], argv=command,
envv=env.items(), directory=cwd)
while self.vte_fork_running:
gtk.main_iteration()
+ self.child_pid = None
return self.vte_child_exit_status
def on_vte_eof_cb(self, terminal):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]