Patchwork [bitbake-devel,4/4] terminal: Send LogExecTTY event to spawn screen

login
register
mail settings
Submitter Jason Wessel
Date Sept. 17, 2012, 10:43 p.m.
Message ID <1347921831-60604-5-git-send-email-jason.wessel@windriver.com>
Download mbox | patch
Permalink /patch/36685/
State New
Headers show

Comments

Jason Wessel - Sept. 17, 2012, 10:43 p.m.
Bitbake has the ability to request to run a command
and if it is not possible fall back to emitting a
log message.  This can be used to start a screen
client automatically on the controling tty if
the UI has an interactive tty.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 meta/lib/oe/terminal.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index c71d6ad..1e74315 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -97,9 +97,14 @@  class Screen(Terminal):
     def __init__(self, sh_cmd, title=None, env=None, d=None):
         s_id = "devshell_%i" % os.getpid()
         self.command = "screen -D -m -t \"{title}\" -S %s {command}" % s_id
-        Terminal.__init__(self, sh_cmd, title, env)
-        logger.warn('Screen started. Please connect in another terminal with '
-                    '"screen -r devshell %s"' % s_id)
+        Terminal.__init__(self, sh_cmd, title, env, d)
+        msg = 'Screen started. Please connect in another terminal with ' \
+            '"screen -r %s"' % s_id
+        if (d):
+            bb.event.fire(bb.event.LogExecTTY(msg, "screen -r %s" % s_id,
+                                              0.5, 10), d)
+        else:
+            logger.warn(msg)
 
 
 def prioritized():