summaryrefslogtreecommitdiffstats
path: root/lldb/third_party/Python/module/pexpect-2.4/examples/python.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-22 19:55:01 +0000
committerZachary Turner <zturner@google.com>2015-10-22 19:55:01 +0000
commit746bb5e4576196afa22d952b9d7865d14e7fc2a1 (patch)
tree2cc7403a75138230cf547070b3c598817ff85bbe /lldb/third_party/Python/module/pexpect-2.4/examples/python.py
parent8daaf8b09b3242d514f9ca20760d52cc091ee2f5 (diff)
downloadbcm5719-llvm-746bb5e4576196afa22d952b9d7865d14e7fc2a1.tar.gz
bcm5719-llvm-746bb5e4576196afa22d952b9d7865d14e7fc2a1.zip
Move third party libraries to lldb/third_party
llvm-svn: 251046
Diffstat (limited to 'lldb/third_party/Python/module/pexpect-2.4/examples/python.py')
-rw-r--r--lldb/third_party/Python/module/pexpect-2.4/examples/python.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/lldb/third_party/Python/module/pexpect-2.4/examples/python.py b/lldb/third_party/Python/module/pexpect-2.4/examples/python.py
new file mode 100644
index 00000000000..d8c986652e6
--- /dev/null
+++ b/lldb/third_party/Python/module/pexpect-2.4/examples/python.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+"""This starts the python interpreter; captures the startup message; then gives
+the user interactive control over the session. Why? For fun... """
+
+# Don't do this unless you like being John Malkovich
+# c = pexpect.spawn ('/usr/bin/env python ./python.py')
+
+import pexpect
+c = pexpect.spawn ('/usr/bin/env python')
+c.expect ('>>>')
+print 'And now for something completely different...'
+f = lambda s:s and f(s[1:])+s[0] # Makes a function to reverse a string.
+print f(c.before)
+print 'Yes, it\'s python, but it\'s backwards.'
+print
+print 'Escape character is \'^]\'.'
+print c.after,
+c.interact()
+c.kill(1)
+print 'is alive:', c.isalive()
+
OpenPOWER on IntegriCloud