Merge pull request #23 from Tyilo/repl-hist

Save the repl's history in ~/.frida_history
This commit is contained in:
Ole André Vadla Ravnås
2015-03-29 15:40:32 +02:00
+14
View File
@@ -14,6 +14,10 @@ def main():
HAVE_READLINE = False
import sys
import threading
import os
if HAVE_READLINE:
HIST_FILE = os.path.join(os.path.expanduser("~"), ".frida_history")
class REPLApplication(ConsoleApplication):
def __init__(self):
@@ -24,6 +28,12 @@ def main():
readline.parse_and_bind("set show-all-if-ambiguous on")
# Set our custom completer
readline.set_completer(self.completer)
try:
readline.read_history_file(HIST_FILE)
except IOError:
pass
self._idle = threading.Event()
self._cond = threading.Condition()
self._response = None
@@ -204,6 +214,10 @@ def main():
if HAVE_READLINE:
readline.add_history(expression)
try:
readline.write_history_file(HIST_FILE)
except IOError:
pass
if expression.endswith("?"):
# Help feature