From 81b5c668ac649bbdbf9dc7e4aab2528f4590d421 Mon Sep 17 00:00:00 2001 From: Ilia K Date: Wed, 11 Feb 2015 04:51:41 +0000 Subject: [PATCH] Close terminal after LaunchInTerminalTestCase test Summary: The test_launch_in_terminal test leaves a running terminal. This patch adds "exit" after debugging with eLaunchFlagLaunchInTTY flag. Reviewers: jingham, zturner, clayborg Reviewed By: clayborg Subscribers: emaste, vharron, lldb-commits, clayborg, jingham, zturner Differential Revision: http://reviews.llvm.org/D7468 llvm-svn: 228801 --- lldb/include/lldb/lldb-enumerations.h | 1 + lldb/source/Host/macosx/Host.mm | 2 ++ lldb/test/functionalities/tty/TestTerminal.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 61ebbcd..1c04f37 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -52,6 +52,7 @@ namespace lldb { eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub should detach rather than killing the debugee ///< if it loses connection with lldb. eLaunchFlagGlobArguments = (1u << 10), ///< Glob arguments without going through a shell + eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit } LaunchFlags; //---------------------------------------------------------------------- diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index 1c0c91c..58b9b42 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -471,6 +471,8 @@ LaunchInNewTerminalWithAppleScript (const char *exe_path, ProcessLaunchInfo &lau command.Printf(" '%s'", exe_path); } command.PutCString (" ; echo Process exited with status $?"); + if (launch_info.GetFlags().Test(lldb::eLaunchFlagCloseTTYOnExit)) + command.PutCString (" ; exit"); StreamString applescript_source; diff --git a/lldb/test/functionalities/tty/TestTerminal.py b/lldb/test/functionalities/tty/TestTerminal.py index 3226d4d..b5b2381 100644 --- a/lldb/test/functionalities/tty/TestTerminal.py +++ b/lldb/test/functionalities/tty/TestTerminal.py @@ -30,7 +30,7 @@ class LaunchInTerminalTestCase(TestBase): exe = "/bin/ls" target = self.dbg.CreateTarget(exe) launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"]) - launch_info.SetLaunchFlags(lldb.eLaunchFlagLaunchInTTY) + launch_info.SetLaunchFlags(lldb.eLaunchFlagLaunchInTTY | lldb.eLaunchFlagCloseTTYOnExit) error = lldb.SBError() process = target.Launch (launch_info, error) self.assertTrue(error.Success(), "Make sure launch happened successfully in a terminal window") -- 2.7.4