diff options
author | Rob Austein <sra@hactrn.net> | 2016-03-21 02:39:08 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-03-21 02:39:08 +0000 |
commit | 004393bdc2f3df5d85da88819bf47d72a883f7bb (patch) | |
tree | f325be9f47b29c5f134832f4933ff0066529c8de /rpki/cli.py | |
parent | d3cb2a1152bdb9a0cb391a388c702ff2f3be8371 (diff) |
Rework rpkic setuid handling to something a bit more robust.
svn path=/branches/tk705/; revision=6322
Diffstat (limited to 'rpki/cli.py')
-rw-r--r-- | rpki/cli.py | 22 |
1 files changed, 20 insertions, 2 deletions
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 |