From b10556e23caccdaf1909e453170a086671fa8a94 Mon Sep 17 00:00:00 2001 From: Mason Larobina Date: Sun, 28 Feb 2010 17:50:38 +0800 Subject: process.wait() will hang if the instance sigterms, use poll() + timeout. --- examples/data/scripts/uzbl-tabbed | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'examples/data/scripts/uzbl-tabbed') diff --git a/examples/data/scripts/uzbl-tabbed b/examples/data/scripts/uzbl-tabbed index 8d0d34a..ea130f5 100755 --- a/examples/data/scripts/uzbl-tabbed +++ b/examples/data/scripts/uzbl-tabbed @@ -521,7 +521,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: -- cgit v1.2.3