diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/terminal.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py index 61c2687ef4..59aa80de66 100644 --- a/meta/lib/oe/terminal.py +++ b/meta/lib/oe/terminal.py | |||
@@ -163,7 +163,12 @@ class Tmux(Terminal): | |||
163 | # devshells, if it's already there, add a new window to it. | 163 | # devshells, if it's already there, add a new window to it. |
164 | window_name = 'devshell-%i' % os.getpid() | 164 | window_name = 'devshell-%i' % os.getpid() |
165 | 165 | ||
166 | self.command = 'tmux new -c "{{cwd}}" -d -s {0} -n {0} "{{command}}"'.format(window_name) | 166 | self.command = 'tmux new -c "{{cwd}}" -d -s {0} -n {0} "{{command}}"' |
167 | if not check_tmux_version('1.9'): | ||
168 | # `tmux new-session -c` was added in 1.9; | ||
169 | # older versions fail with that flag | ||
170 | self.command = 'tmux new -d -s {0} -n {0} "{{command}}"' | ||
171 | self.command = self.command.format(window_name) | ||
167 | Terminal.__init__(self, sh_cmd, title, env, d) | 172 | Terminal.__init__(self, sh_cmd, title, env, d) |
168 | 173 | ||
169 | attach_cmd = 'tmux att -t {0}'.format(window_name) | 174 | attach_cmd = 'tmux att -t {0}'.format(window_name) |
@@ -253,13 +258,18 @@ def spawn(name, sh_cmd, title=None, env=None, d=None): | |||
253 | except OSError: | 258 | except OSError: |
254 | return | 259 | return |
255 | 260 | ||
261 | def check_tmux_version(desired): | ||
262 | vernum = check_terminal_version("tmux") | ||
263 | if vernum and LooseVersion(vernum) < desired: | ||
264 | return False | ||
265 | return vernum | ||
266 | |||
256 | def check_tmux_pane_size(tmux): | 267 | def check_tmux_pane_size(tmux): |
257 | import subprocess as sub | 268 | import subprocess as sub |
258 | # On older tmux versions (<1.9), return false. The reason | 269 | # On older tmux versions (<1.9), return false. The reason |
259 | # is that there is no easy way to get the height of the active panel | 270 | # is that there is no easy way to get the height of the active panel |
260 | # on current window without nested formats (available from version 1.9) | 271 | # on current window without nested formats (available from version 1.9) |
261 | vernum = check_terminal_version("tmux") | 272 | if not check_tmux_version('1.9'): |
262 | if vernum and LooseVersion(vernum) < '1.9': | ||
263 | return False | 273 | return False |
264 | try: | 274 | try: |
265 | p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux, | 275 | p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux, |