[Lldb-commits] [PATCH] D25750: When invoking Terminal, don't assume the default shell

Chris Bieneman via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 18 13:53:42 PDT 2016

beanz created this revision.
beanz added a reviewer: tfiala.
beanz added a subscriber: lldb-commits.

If a user has their shell set to a non-POSIX conferment shell the TestTerminal.py tests fail because the shell blurb constructed here may not work in their shell.

In my specific case fish-shell (The Friendly Interactive Shell - http://fishshell.com) does not support $?, it instead uses $status (because it is friendly).

This patch removes the assumption of your default shell by running the constructed bash command via "/bin/bash -c ...". This should be safer for users mutating their shell environment.



Index: source/Host/macosx/Host.mm
--- source/Host/macosx/Host.mm
+++ source/Host/macosx/Host.mm
@@ -354,11 +354,11 @@
 const char *applscript_in_new_tty = "tell application \"Terminal\"\n"
                                     "   activate\n"
-                                    "	do script \"%s\"\n"
+                                    "	do script \"/bin/bash -c '%s';exit\"\n"
                                     "end tell\n";
 const char *applscript_in_existing_tty = "\
-set the_shell_script to \"%s\"\n\
+set the_shell_script to \"/bin/bash -c '%s';exit\"\n\
 tell application \"Terminal\"\n\
 	repeat with the_window in (get windows)\n\
 		repeat with the_tab in tabs of the_window\n\

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25750.75069.patch
Type: text/x-patch
Size: 765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20161018/550c23ce/attachment.bin>

More information about the lldb-commits mailing list