summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/terminal.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/terminal.py')
-rw-r--r--meta/lib/oe/terminal.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index eb10a6e33e..a0c166d884 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -102,6 +102,10 @@ class Rxvt(XTerminal):
102 command = 'rxvt -T "{title}" -e {command}' 102 command = 'rxvt -T "{title}" -e {command}'
103 priority = 1 103 priority = 1
104 104
105class URxvt(XTerminal):
106 command = 'urxvt -T "{title}" -e {command}'
107 priority = 1
108
105class Screen(Terminal): 109class Screen(Terminal):
106 command = 'screen -D -m -t "{title}" -S devshell {command}' 110 command = 'screen -D -m -t "{title}" -S devshell {command}'
107 111
@@ -163,7 +167,12 @@ class Tmux(Terminal):
163 # devshells, if it's already there, add a new window to it. 167 # devshells, if it's already there, add a new window to it.
164 window_name = 'devshell-%i' % os.getpid() 168 window_name = 'devshell-%i' % os.getpid()
165 169
166 self.command = 'tmux new -c "{{cwd}}" -d -s {0} -n {0} "{{command}}"'.format(window_name) 170 self.command = 'tmux new -c "{{cwd}}" -d -s {0} -n {0} "{{command}}"'
171 if not check_tmux_version('1.9'):
172 # `tmux new-session -c` was added in 1.9;
173 # older versions fail with that flag
174 self.command = 'tmux new -d -s {0} -n {0} "{{command}}"'
175 self.command = self.command.format(window_name)
167 Terminal.__init__(self, sh_cmd, title, env, d) 176 Terminal.__init__(self, sh_cmd, title, env, d)
168 177
169 attach_cmd = 'tmux att -t {0}'.format(window_name) 178 attach_cmd = 'tmux att -t {0}'.format(window_name)
@@ -253,13 +262,18 @@ def spawn(name, sh_cmd, title=None, env=None, d=None):
253 except OSError: 262 except OSError:
254 return 263 return
255 264
265def check_tmux_version(desired):
266 vernum = check_terminal_version("tmux")
267 if vernum and LooseVersion(vernum) < desired:
268 return False
269 return vernum
270
256def check_tmux_pane_size(tmux): 271def check_tmux_pane_size(tmux):
257 import subprocess as sub 272 import subprocess as sub
258 # On older tmux versions (<1.9), return false. The reason 273 # 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 274 # 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) 275 # on current window without nested formats (available from version 1.9)
261 vernum = check_terminal_version("tmux") 276 if not check_tmux_version('1.9'):
262 if vernum and LooseVersion(vernum) < '1.9':
263 return False 277 return False
264 try: 278 try:
265 p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux, 279 p = sub.Popen('%s list-panes -F "#{?pane_active,#{pane_height},}"' % tmux,