From 1e3ed1e4b902842a1b9deab89fddeb071367d4af Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Mon, 10 Feb 2025 17:10:49 +0800 Subject: [PATCH] run_cached_tests: output mitmdump logs --- scripts/run_cached_tests | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/run_cached_tests b/scripts/run_cached_tests index f455da1..8fcab70 100755 --- a/scripts/run_cached_tests +++ b/scripts/run_cached_tests @@ -3,13 +3,25 @@ mitmdump=${mitmdump:-mitmdump} if [[ -f ~/.mitmproxy/nvdump ]]; then - $mitmdump -S ~/.mitmproxy/nvdump -p 7890 --ignore-hosts '127\.0\.0\.1' --server-replay-reuse --server-replay-extra=forward -w newdump >/dev/null & + $mitmdump -S ~/.mitmproxy/nvdump -p 7890 --ignore-hosts '127\.0\.0\.1' --server-replay-reuse --server-replay-extra=forward -w newdump >mitmdump_output & else - $mitmdump -w ~/.mitmproxy/nvdump -p 7890 --ignore-hosts '127\.0\.0\.1' >/dev/null & + $mitmdump -w ~/.mitmproxy/nvdump -p 7890 --ignore-hosts '127\.0\.0\.1' >mitmdump_output & fi mitm_pid=$! +on_exit () { + kill -INT $mitm_pid + + if [[ -s newdump ]]; then + cat newdump >> ~/.mitmproxy/nvdump + fi + + cat mitmdump_output +} + +trap on_exit EXIT + if [[ -f keyfile.toml ]]; then export KEYFILE=keyfile.toml fi @@ -26,9 +38,3 @@ export GIT_SSL_CAINFO=$SSL_CERT_FILE export http_proxy=http://localhost:7890 https_proxy=http://localhost:7890 pytest - -kill -INT $mitm_pid - -if [[ -s newdump ]]; then - cat newdump >> ~/.mitmproxy/nvdump -fi