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.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 4c1e318c7c..2e23d59cae 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -105,6 +105,43 @@ class Screen(Terminal):
105 else: 105 else:
106 logger.warn(msg) 106 logger.warn(msg)
107 107
108class TmuxRunning(Terminal):
109 """Open a new pane in the current running tmux window"""
110 command = 'tmux split-window {command}'
111 priority = 2.75
112
113 def __init__(self, sh_cmd, title=None, env=None, d=None):
114 if not bb.utils.which(os.getenv('PATH'), 'tmux'):
115 raise UnsupportedTerminal('tmux is not installed')
116
117 if not os.getenv('TMUX'):
118 raise UnsupportedTerminal('tmux is not running')
119
120 Terminal.__init__(self, sh_cmd, title, env, d)
121
122class TmuxNewSession(Terminal):
123 """Start a new tmux session and window"""
124 command = 'tmux new -d -s devshell -n devshell {command}'
125 priority = 0.75
126
127 def __init__(self, sh_cmd, title=None, env=None, d=None):
128 if not bb.utils.which(os.getenv('PATH'), 'tmux'):
129 raise UnsupportedTerminal('tmux is not installed')
130
131 # TODO: consider using a 'devshell' session shared amongst all
132 # devshells, if it's already there, add a new window to it.
133 window_name = 'devshell-%i' % os.getpid()
134
135 self.command = 'tmux new -d -s {0} -n {0} {{command}}'.format(window_name)
136 Terminal.__init__(self, sh_cmd, title, env, d)
137
138 attach_cmd = 'tmux att -t {0}'.format(window_name)
139 msg = 'Tmux started. Please connect in another terminal with `tmux att -t {0}`'.format(window_name)
140 if d:
141 bb.event.fire(bb.event.LogExecTTY(msg, attach_cmd, 0.5, 10), d)
142 else:
143 logger.warn(msg)
144
108class Custom(Terminal): 145class Custom(Terminal):
109 command = 'false' # This is a placeholder 146 command = 'false' # This is a placeholder
110 priority = 3 147 priority = 3