summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2021-01-28 16:49:19 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2021-01-28 16:49:19 -0500
commit188f251fa339eda74a97a790ac33b02a18363462 (patch)
tree7be5143852e055f2479dc5acb4b93d93e544cb9d /cmd2/cmd2.py
parentda203d25dff1f05511af43b4f73fd537678d6e03 (diff)
downloadcmd2-git-header_tabs.tar.gz
Fixed FileNotFoundError which occurred when running 'history --clear' and no history file existed.header_tabs
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 8ad3f7ba..ab72f1a6 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3989,7 +3989,10 @@ class Cmd(cmd.Cmd):
self.history.clear()
if self.persistent_history_file:
- os.remove(self.persistent_history_file)
+ try:
+ os.remove(self.persistent_history_file)
+ except FileNotFoundError:
+ pass
if rl_type != RlType.NONE:
readline.clear_history()