diff options
author | Thomas Roth <code@leveldown.de> | 2010-02-25 12:14:47 +0100 |
---|---|---|
committer | Thomas Roth <code@leveldown.de> | 2010-02-25 12:14:47 +0100 |
commit | 000196fe21bfc3980e90e20ff013c4b393eb5190 (patch) | |
tree | 7d8ac458ca6d18784a729886fba42ef72b5ffdc0 | |
parent | 6d41b27f534a97c116c30701485595a574df24f0 (diff) | |
download | mitmproxy-000196fe21bfc3980e90e20ff013c4b393eb5190.tar.gz mitmproxy-000196fe21bfc3980e90e20ff013c4b393eb5190.tar.bz2 mitmproxy-000196fe21bfc3980e90e20ff013c4b393eb5190.zip |
Added exception if starting editor fails and added vi as default editor.
-rw-r--r-- | libmproxy/console.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libmproxy/console.py b/libmproxy/console.py index fe2fa4b2..f666f71a 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -244,8 +244,18 @@ class ConnectionView(urwid.WidgetWrap): os.write(fd, data) os.close(fd) c = os.environ.get("EDITOR") + #If no EDITOR is set, assume 'vi' + if not c: + c = "vi" cmd = [c, name] - ret = subprocess.call(cmd) + try: + ret = subprocess.call(cmd) + except: + self.master.statusbar.message("Can't start editor: %s" % c) + self.master.ui._curs_set(1) + self.master.ui.clear() + os.unlink(name) + return data # Not sure why, unless we do this we get a visible cursor after # spawning 'less'. self.master.ui._curs_set(1) |