From e3c8d662609820074b7e73e921e2153877002944 Mon Sep 17 00:00:00 2001 From: Asger Hautop Drewsen Date: Sun, 29 Mar 2015 15:35:54 +0200 Subject: [PATCH] Save the repl's history in ~/.frida_history --- src/frida/repl.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/frida/repl.py b/src/frida/repl.py index c7710d0..5e4bbf1 100644 --- a/src/frida/repl.py +++ b/src/frida/repl.py @@ -13,6 +13,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): @@ -23,6 +27,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 @@ -203,6 +213,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