aboutsummaryrefslogtreecommitdiffstats
path: root/mitmdump
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-04-15 10:35:19 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-04-15 10:35:19 +1200
commit2162ce1ae349d5a39364cc7e074a5b30ff12785c (patch)
treeaae838a0a1be4ae62bf9c7e03e2cf687761c210b /mitmdump
parente5c076ab4edee4c7989b72113dbddb9012ea6e64 (diff)
downloadmitmproxy-2162ce1ae349d5a39364cc7e074a5b30ff12785c.tar.gz
mitmproxy-2162ce1ae349d5a39364cc7e074a5b30ff12785c.tar.bz2
mitmproxy-2162ce1ae349d5a39364cc7e074a5b30ff12785c.zip
Shut mitmdump down gracefully on SIGTERM.
This is a hack at the moment, but needs must.
Diffstat (limited to 'mitmdump')
-rwxr-xr-xmitmdump8
1 files changed, 7 insertions, 1 deletions
diff --git a/mitmdump b/mitmdump
index 83748c71..3c2b5fce 100755
--- a/mitmdump
+++ b/mitmdump
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import sys
+import sys, signal
from libmproxy import proxy, dump, cmdline
from libmproxy.version import VERSION
from optparse import OptionParser
@@ -62,9 +62,15 @@ if __name__ == '__main__':
try:
m = dump.DumpMaster(server, dumpopts, filt)
+ def cleankill(*args, **kwargs):
+ m.shutdown()
+ signal.signal(signal.SIGTERM, cleankill)
m.run()
except dump.DumpError, e:
print >> sys.stderr, "mitmdump:", e
sys.exit(1)
except KeyboardInterrupt:
pass
+
+
+