diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2015-02-16 14:55:36 +0100 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2015-02-16 14:55:36 +0100 |
| commit | 94ec542fe0f9aa192a0424d4c47de99ae34caf67 (patch) | |
| tree | c9155c517e0237d663c3f5aee2471371d6138d24 /py3status | |
| parent | 83b700a12350b8e70049d0725c2ed30ba1ea4e80 (diff) | |
fix i3status setup race condition reported by @tasse
Diffstat (limited to 'py3status')
| -rwxr-xr-x | py3status/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/py3status/__init__.py b/py3status/__init__.py index e8e34e6..f8a1dcf 100755 --- a/py3status/__init__.py +++ b/py3status/__init__.py @@ -105,6 +105,7 @@ class I3status(Thread): self.last_output_ts = None self.last_prefix = None self.lock = lock + self.ready = False self.standalone = standalone self.tmpfile_path = None # @@ -488,6 +489,7 @@ class I3status(Thread): line = self.poller_inp.readline(timeout) if line: if line.startswith('[{'): + print_line(line) with jsonify(line) as (prefix, json_list): self.last_output = json_list self.last_output_ts = datetime.utcnow() @@ -497,7 +499,7 @@ class I3status(Thread): # on first i3status output, we parse # the time and tztime modules self.set_time_modules() - print_line(line) + self.ready = True elif not line.startswith(','): if 'version' in line: header = loads(line) @@ -1287,7 +1289,7 @@ class Py3statusWrapper(): self.i3status_thread.mock() else: self.i3status_thread.start() - while not self.i3status_thread.last_output: + while not self.i3status_thread.ready: if not self.i3status_thread.is_alive(): err = self.i3status_thread.error raise IOError(err) |
