aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2010-02-28 17:50:38 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2010-03-12 13:01:15 +0800
commitd5d168574bdf350e5d8b40becb572a247a9d5e1e (patch)
treee7277305eab64e44955eac6b2dc0a4a8d0f762a3
parentdd459eeaaa5da12ecc5d369b9df46092dc7cc97d (diff)
process.wait() will hang if the instance sigterms, use poll() + timeout.
-rwxr-xr-xexamples/data/scripts/uzbl-tabbed13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/data/scripts/uzbl-tabbed b/examples/data/scripts/uzbl-tabbed
index e542dbf..f07bae4 100755
--- a/examples/data/scripts/uzbl-tabbed
+++ b/examples/data/scripts/uzbl-tabbed
@@ -528,7 +528,18 @@ class UzblInstance:
if self._client:
self._client.close()
self._client = None
- self.process.wait()
+
+ pid = self.process.pid
+ timeout = time.time() + 5
+
+ while self.process.poll() is None and time.time() < timeout:
+ # Sleep between polls.
+ time.sleep(0.1)
+
+ if self.process.poll() is None:
+ # uzbl instance didn't exit in time.
+ error("quit timeout expired, sending SIGTERM to uzbl instance")
+ self.process.terminate()
class UzblTabbed: