diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-02-08 18:25:00 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-02-08 18:25:00 +1300 |
commit | 76f2595df76f81bdbca360fe032167b6b1269a4d (patch) | |
tree | 99fbef5d9b9281dabcc6b289d3aeab132f6b80d1 /libmproxy/console/connview.py | |
parent | 4026aa2e5f6929633b4800d55cf26698f9dd3c40 (diff) | |
download | mitmproxy-76f2595df76f81bdbca360fe032167b6b1269a4d.tar.gz mitmproxy-76f2595df76f81bdbca360fe032167b6b1269a4d.tar.bz2 mitmproxy-76f2595df76f81bdbca360fe032167b6b1269a4d.zip |
KVEditor: "e" shortcut spawns an external editor on a field.
Diffstat (limited to 'libmproxy/console/connview.py')
-rw-r--r-- | libmproxy/console/connview.py | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/libmproxy/console/connview.py b/libmproxy/console/connview.py index ac25ea9a..0b354479 100644 --- a/libmproxy/console/connview.py +++ b/libmproxy/console/connview.py @@ -275,28 +275,6 @@ class ConnectionView(common.WWrap): else: self.view_request() - def _spawn_editor(self, data): - fd, name = tempfile.mkstemp('', "mproxy") - 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] - self.master.ui.stop() - try: - subprocess.call(cmd) - except: - self.master.statusbar.message("Can't start editor: %s" % c) - self.master.ui.start() - os.unlink(name) - return data - self.master.ui.start() - data = open(name).read() - os.unlink(name) - return data - def edit_method(self, m): for i in self.methods: if i[1] == m: @@ -354,7 +332,7 @@ class ConnectionView(common.WWrap): self.flow.backup() if part == "b": - c = self._spawn_editor(conn.content or "") + c = self.master.spawn_editor(conn.content or "") conn.content = c.rstrip("\n") elif part == "h": self.master.view_kveditor("Editing headers", conn.headers.lst, self.set_headers, conn) |