From 004393bdc2f3df5d85da88819bf47d72a883f7bb Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 21 Mar 2016 02:39:08 +0000 Subject: Rework rpkic setuid handling to something a bit more robust. svn path=/branches/tk705/; revision=6322 --- rpki/cli.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'rpki/cli.py') diff --git a/rpki/cli.py b/rpki/cli.py index 2f007101..cbd2b1e1 100644 --- a/rpki/cli.py +++ b/rpki/cli.py @@ -165,7 +165,7 @@ class Cmd(cmd.Cmd): old_completer_delims = readline.get_completer_delims() if self.histfile is not None: try: - readline.read_history_file(self.histfile) + self.read_history() except IOError: pass try: @@ -174,11 +174,29 @@ class Cmd(cmd.Cmd): finally: if self.histfile is not None and readline.get_current_history_length(): try: - readline.write_history_file(self.histfile) + self.save_history() except IOError: pass readline.set_completer_delims(old_completer_delims) + def read_history(self): + """ + Read readline history from file. + + This is a separate method so that subclasses can wrap it when necessary. + """ + + readline.read_history_file(self.histfile) + + def save_history(self): + """ + Save readline history to file. + + This is a separate method so that subclasses can wrap it when necessary. + """ + + readline.write_history_file(self.histfile) + else: cmdloop_with_history = cmd.Cmd.cmdloop -- cgit v1.2.3