aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2011-02-02 10:08:24 +1300
committerAldo Cortesi <aldo@nullcube.com>2011-02-02 10:09:16 +1300
commit405e60215ce135ef7e94803d25c34404d742a06e (patch)
tree8394d61cf77da8ed89dcff240055f32d2e562b3e /libmproxy/flow.py
parentb886f808beaba097066a1b82fe560b1e70099df0 (diff)
downloadmitmproxy-405e60215ce135ef7e94803d25c34404d742a06e.tar.gz
mitmproxy-405e60215ce135ef7e94803d25c34404d742a06e.tar.bz2
mitmproxy-405e60215ce135ef7e94803d25c34404d742a06e.zip
View script debug output (stderr) in pager.
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index c0b96c90..d3bba4b3 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -53,13 +53,19 @@ class Flow:
def run_script(self, path):
"""
- Run a script on a flow, returning the modified flow.
+ Run a script on a flow.
- Raises RunException if there's an error.
+ Returns a (flow, stderr output) tuple, or raises RunException if
+ there's an error.
"""
data = self.script_serialize()
try:
- p = subprocess.Popen([path], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+ p = subprocess.Popen(
+ [path],
+ stdout=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ )
except OSError, e:
raise RunException(e.args[1])
so, se = p.communicate(data)
@@ -68,7 +74,7 @@ class Flow:
f = Flow.script_deserialize(so)
if not f:
raise RunException("Invalid response from script.")
- return f
+ return f, se
def dump(self):
data = dict(