[strongwind] Set the process group of our launched application
- From: Brad Taylor <btaylor src gnome org>
- To: svn-commits-list gnome org
- Subject: [strongwind] Set the process group of our launched application
- Date: Tue, 16 Jun 2009 13:47:53 -0400 (EDT)
commit 422ff2bb37836e4937c4ba5091310a40f7ae4f08
Author: Brad Taylor <brad getcoded net>
Date: Tue Jun 16 09:43:00 2009 -0400
Set the process group of our launched application
This allows the application and all of its children to be killed with
os.killpg(proc.pid, signal.SIGKILL). (#585983)
ChangeLog | 6 ++++++
strongwind/cache.py | 9 ++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6eb3eb2..e75a520 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-16 Brad Taylor <brad getcoded net>
+
+ * strongwind/cache.py: Set the process group of our launched
+ application so that the application and its children can be killed with
+ os.killpg(proc.pid, signal.SIGKILL). (#585983)
+
2009-04-07 Brian G. Merrell <bgmerrell novell com>
* strongwind/accessibles.py: No longer cache the log name as the
diff --git a/strongwind/cache.py b/strongwind/cache.py
index 4a53cf8..7aed1c3 100644
--- a/strongwind/cache.py
+++ b/strongwind/cache.py
@@ -235,8 +235,15 @@ def launchApplication(args=[], name=None, find=None, cwd=None, env=None, wait=co
# instance of the application already open
existingApp = findAppWithLargestId(_desktop, find)
+ def group_setup():
+ '''
+ Ensure that all forked processes keep the same process group so that
+ they can be killed with os.killpg(proc.pid, signal.SIGTERM) later.
+ '''
+ os.setpgid(0, 0)
+
# launch the application
- subproc = subprocess.Popen(args, cwd=cwd, env=env)
+ subproc = subprocess.Popen(args, cwd=cwd, env=env, preexec_fn=group_setup)
# wait for the application to launch and for the applications list to
# settle. if we try to list the desktop's applications too soon, we get
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]