This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Lua] Recognize "quit" as a way to exit the interactive script interpreter.
ClosedPublic

Authored by JDevlieghere on Jun 21 2020, 12:31 AM.

Details

Summary

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.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Jun 21 2020, 12:31 AM
labath accepted this revision.Jun 22 2020, 5:52 AM

It seems reasonable. Btw, have you figured out how the embedded python does it? -- I haven't been able to find the code for handling that.

The python interpreter also intercepts os.exit() to avoid terminating the program (it just terminates the python session). I suppose we should do the same with lua's os.exit...

This revision is now accepted and ready to land.Jun 22 2020, 5:52 AM

It seems reasonable. Btw, have you figured out how the embedded python does it? -- I haven't been able to find the code for handling that.

No, I couldn't find the code either.

The python interpreter also intercepts os.exit() to avoid terminating the program (it just terminates the python session). I suppose we should do the same with lua's os.exit...

Yep, that sounds good.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2020, 9:40 AM