diff options
| author | Steven Myint <git@stevenmyint.com> | 2013-10-07 19:52:22 -0700 |
|---|---|---|
| committer | Steven Myint <git@stevenmyint.com> | 2013-10-07 19:52:22 -0700 |
| commit | 1141915a17bd446d330de0c8fe3a017ebc6b2e06 (patch) | |
| tree | 64d33533233b1e71f08dba9cfb6266ce7213fe34 /examples | |
| parent | 0601480ee490140598a31401d7ac96807181116c (diff) | |
| download | pexpect-1141915a17bd446d330de0c8fe3a017ebc6b2e06.tar.gz | |
Avoid "spawnu" to match pxssh interface
It looks like no one ever tested the ssh case, as
"use_localhost" was not even defined in the "False" case.
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/topip.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/topip.py b/examples/topip.py index caed606..a38f3aa 100755 --- a/examples/topip.py +++ b/examples/topip.py @@ -176,6 +176,7 @@ def main(): password = options['-p'] else: password = getpass.getpass('password: ') + use_localhost = False else: use_localhost = True @@ -213,7 +214,7 @@ def main(): # run netstat (either locally or via SSH). if use_localhost: - p = pexpect.spawnu('netstat -n -t') + p = pexpect.spawn('netstat -n -t') PROMPT = pexpect.TIMEOUT else: p = pxssh.pxssh() @@ -228,7 +229,7 @@ def main(): i = p.expect([PROMPT, netstat_pattern]) if i == 0: break - k = p.match.groups()[4] + k = p.match.groups()[4].decode('utf-8') if k in ip_list: ip_list[k] = ip_list[k] + 1 else: |
