diff options
author | Mason Larobina <mason.larobina@gmail.com> | 2010-02-28 17:50:38 +0800 |
---|---|---|
committer | Mason Larobina <mason.larobina@gmail.com> | 2010-02-28 17:50:38 +0800 |
commit | b10556e23caccdaf1909e453170a086671fa8a94 (patch) | |
tree | cced61612c9ad5927a45ae11889e664e532642b4 /examples/data/scripts/uzbl-tabbed | |
parent | af1d9e76718bac684a6e4132385811b166a7252f (diff) |
process.wait() will hang if the instance sigterms, use poll() + timeout.
Diffstat (limited to 'examples/data/scripts/uzbl-tabbed')
-rwxr-xr-x | examples/data/scripts/uzbl-tabbed | 13 |
1 files changed, 12 insertions, 1 deletions
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: |