diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-06-21 00:31:46 -0700 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-06-22 09:27:12 -0700 |
| commit | 1728dec255a5336303b301e26ec22eca2000b593 (patch) | |
| tree | cfc51505e60bb722a592e4145a18ebaefdd48ba0 /lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp | |
| parent | 9934cc544cae4e4fa969657387f5251e42206e1a (diff) | |
[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
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp')
| -rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Lua/ScriptInterpreterLua.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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)); } |
