From 505da188ebe9ac25128dfa5aa5c8b4b0fa05b68f Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Wed, 5 Dec 2012 12:58:29 -0800 Subject: Show an error when $EDITOR/$PAGER are unset. This catches an exception that otherwise crashes mitmproxy. fixes cortesi/mitmproxy#71 --- libmproxy/console/flowview.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libmproxy/console') 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, -- cgit v1.2.3