mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Added exception if starting editor fails and added vi as default editor.
This commit is contained in:
parent
6d41b27f53
commit
000196fe21
@ -244,8 +244,18 @@ class ConnectionView(urwid.WidgetWrap):
|
|||||||
os.write(fd, data)
|
os.write(fd, data)
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
c = os.environ.get("EDITOR")
|
c = os.environ.get("EDITOR")
|
||||||
|
#If no EDITOR is set, assume 'vi'
|
||||||
|
if not c:
|
||||||
|
c = "vi"
|
||||||
cmd = [c, name]
|
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
|
# Not sure why, unless we do this we get a visible cursor after
|
||||||
# spawning 'less'.
|
# spawning 'less'.
|
||||||
self.master.ui._curs_set(1)
|
self.master.ui._curs_set(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user