Author: cbieneman
Date: Tue Oct 18 18:55:34 2016
New Revision: 284552

URL: http://llvm.org/viewvc/llvm-project?rev=284552&view=rev
Log:
When invoking Terminal, don't assume the default shell

Summary:
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.

Reviewers: tfiala

Subscribers: joerg, lldb-commits

Differential Revision: https://reviews.llvm.org/D25750

Modified:
    lldb/trunk/source/Host/macosx/Host.mm

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=284552&r1=284551&r2=284552&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Tue Oct 18 18:55:34 2016
@@ -354,11 +354,11 @@ static bool WaitForProcessToSIGSTOP(cons
 
 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\


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to