diff options
author | Nathan Rossi <nathan@nathanrossi.com> | 2019-04-02 08:17:39 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-03 14:50:13 +0100 |
commit | 20ebaff9ee9d7392eb02b5df1391efbfedd3bba5 (patch) | |
tree | 4d8542d2bc6608c8a7d0ce9bbe01473636b5c785 | |
parent | 8491b09e4ecabca8babe79e4140313d2cbca7020 (diff) | |
download | poky-20ebaff9ee9d7392eb02b5df1391efbfedd3bba5.tar.gz |
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.
(From OE-Core rev: 53724281eb486847bc3be824aa4513a8688ec296)
Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/terminal.bbclass | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/terminal.bbclass b/meta/classes/terminal.bbclass index 73e765d57a..6059ae95e0 100644 --- a/meta/classes/terminal.bbclass +++ b/meta/classes/terminal.bbclass | |||
@@ -14,6 +14,7 @@ def oe_terminal_prioritized(): | |||
14 | return " ".join(o.name for o in oe.terminal.prioritized()) | 14 | return " ".join(o.name for o in oe.terminal.prioritized()) |
15 | 15 | ||
16 | def emit_terminal_func(command, envdata, d): | 16 | def emit_terminal_func(command, envdata, d): |
17 | import bb.build | ||
17 | cmd_func = 'do_terminal' | 18 | cmd_func = 'do_terminal' |
18 | 19 | ||
19 | envdata.setVar(cmd_func, 'exec ' + command) | 20 | envdata.setVar(cmd_func, 'exec ' + command) |
@@ -25,8 +26,7 @@ def emit_terminal_func(command, envdata, d): | |||
25 | bb.utils.mkdirhier(os.path.dirname(runfile)) | 26 | bb.utils.mkdirhier(os.path.dirname(runfile)) |
26 | 27 | ||
27 | with open(runfile, 'w') as script: | 28 | with open(runfile, 'w') as script: |
28 | script.write('#!/usr/bin/env %s\n' % d.getVar('SHELL')) | 29 | script.write(bb.build.shell_trap_code()) |
29 | script.write('set -e\n') | ||
30 | bb.data.emit_func(cmd_func, script, envdata) | 30 | bb.data.emit_func(cmd_func, script, envdata) |
31 | script.write(cmd_func) | 31 | script.write(cmd_func) |
32 | script.write("\n") | 32 | script.write("\n") |