aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/addons
diff options
context:
space:
mode:
authorHenrique <typoon@gmail.com>2019-11-25 09:17:40 -0500
committerHenrique <typoon@gmail.com>2019-11-25 09:17:40 -0500
commit1b5337e4d44ec0b3d3dc34d8bac66aa0ffff480a (patch)
treeda6762aa43d1540ce7c1ee03bca464939c2fc103 /mitmproxy/addons
parent0d29804ab852893e4e41c415de1ce3cc08ffcfae (diff)
downloadmitmproxy-1b5337e4d44ec0b3d3dc34d8bac66aa0ffff480a.tar.gz
mitmproxy-1b5337e4d44ec0b3d3dc34d8bac66aa0ffff480a.tar.bz2
mitmproxy-1b5337e4d44ec0b3d3dc34d8bac66aa0ffff480a.zip
Making windows happy
Diffstat (limited to 'mitmproxy/addons')
-rw-r--r--mitmproxy/addons/command_history.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mitmproxy/addons/command_history.py b/mitmproxy/addons/command_history.py
index c66af2be..8c1ef052 100644
--- a/mitmproxy/addons/command_history.py
+++ b/mitmproxy/addons/command_history.py
@@ -1,6 +1,7 @@
import collections
import os
import typing
+import atexit
from mitmproxy import command
from mitmproxy import ctx
@@ -28,6 +29,12 @@ class CommandHistory:
for l in _history_lines:
self.add_command(l.strip())
+ atexit.register(self.cleanup)
+
+ def cleanup(self):
+ if self.command_history_file:
+ self.command_history_file.close()
+
@property
def last_filtered_index(self):
return len(self.filtered_commands) - 1