diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-12-05 12:58:29 -0800 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-12-05 12:58:29 -0800 |
commit | 505da188ebe9ac25128dfa5aa5c8b4b0fa05b68f (patch) | |
tree | 48dc02aacf68988d978267d08fa3ee66968b5531 /libmproxy/console | |
parent | 09c29e894e989639a44a00009dae3b8bfc738a84 (diff) | |
download | mitmproxy-505da188ebe9ac25128dfa5aa5c8b4b0fa05b68f.tar.gz mitmproxy-505da188ebe9ac25128dfa5aa5c8b4b0fa05b68f.tar.bz2 mitmproxy-505da188ebe9ac25128dfa5aa5c8b4b0fa05b68f.zip |
Show an error when $EDITOR/$PAGER are unset.
This catches an exception that otherwise crashes mitmproxy.
fixes cortesi/mitmproxy#71
Diffstat (limited to 'libmproxy/console')
-rw-r--r-- | libmproxy/console/flowview.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index 1d1d1e7b..3473c474 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -542,7 +542,10 @@ class FlowView(common.WWrap): if conn and conn.content: t = conn.headers["content-type"] or [None] t = t[0] - self.master.spawn_external_viewer(conn.content, t) + if os.environ.has_key("EDITOR") or os.environ.has_key("PAGER"): + self.master.spawn_external_viewer(conn.content, t) + else: + self.master.statusbar.message("Error! Set $EDITOR or $PAGER.") elif key == "|": self.master.path_prompt( "Send flow to script: ", self.state.last_script, |