From 1728dec255a5336303b301e26ec22eca2000b593 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sun, 21 Jun 2020 00:31:46 -0700 Subject: [lldb/Lua] Recognize "quit" as a way to exit the script interpreter. Add a way to quit the interactive script interpreter from a shell tests. Currently, the only way (that I know) to exit the interactive Lua interpreter is to send a EOF with CTRL-D. I noticed that the embedded Python script interpreter accepts quit (while the regular python interpreter doesn't). I've added a special case to the Lua interpreter to do the same. Differential revision: https://reviews.llvm.org/D82272 --- lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp index cbd639417990..f8fd8ff94aa3 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp @@ -39,6 +39,11 @@ public: void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override { + if (llvm::StringRef(data).rtrim() == "quit") { + io_handler.SetIsDone(true); + return; + } + if (llvm::Error error = m_script_interpreter.GetLua().Run(data)) { *GetOutputStreamFileSP() << llvm::toString(std::move(error)); } -- cgit v1.2.3