[oe-commits] [openembedded-core] 05/12: terminal.bbclass: Generate do_terminal as bitbake would

git at git.openembedded.org git at git.openembedded.org
Wed Apr 3 13:51:14 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 53724281eb486847bc3be824aa4513a8688ec296
Author: Nathan Rossi <nathan at nathanrossi.com>
AuthorDate: Tue Apr 2 08:17:39 2019 +0000

    terminal.bbclass: Generate do_terminal as bitbake would
    
    This changes the runfile that is generated to have the same behaviour as
    bitbake with regards to emitting the shebang and trap code. The existing
    implementation used 'env' with the current var-SHELL. This means that if
    the user has configured there system/environment with a alternate shell
    (e.g. csh, zsh, fish, etc.) the do_terminal function would attempt to
    execute with the wrong/incompatible shell and fail silently.
    
    With this change devshell and other classes that rely on terminal can
    now run when the var-SHELL is not set to a sh compatible shell. For
    devshell, it will launch the devshell with the users configured shell.
    
    Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/terminal.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass
index 73e765d..6059ae9 100644
--- a/meta/classes/terminal.bbclass
+++ b/meta/classes/terminal.bbclass
@@ -14,6 +14,7 @@ def oe_terminal_prioritized():
     return " ".join(o.name for o in oe.terminal.prioritized())
 
 def emit_terminal_func(command, envdata, d):
+    import bb.build
     cmd_func = 'do_terminal'
 
     envdata.setVar(cmd_func, 'exec ' + command)
@@ -25,8 +26,7 @@ def emit_terminal_func(command, envdata, d):
     bb.utils.mkdirhier(os.path.dirname(runfile))
 
     with open(runfile, 'w') as script:
-        script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL'))
-        script.write('set -e\n')
+        script.write(bb.build.shell_trap_code())
         bb.data.emit_func(cmd_func, script, envdata)
         script.write(cmd_func)
         script.write("\n")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list