diff options
-rwxr-xr-x | pexpect/examples/monitor.py | 7 | ||||
-rw-r--r-- | pexpect/pexpect.py | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/pexpect/examples/monitor.py b/pexpect/examples/monitor.py index aab1d17..29e54fc 100755 --- a/pexpect/examples/monitor.py +++ b/pexpect/examples/monitor.py @@ -7,6 +7,7 @@ Run and parse 'uptime'. Run 'iostat'. Run 'vmstat'. + Run 'netstat' Run 'free'. Exit the remote host. @@ -80,6 +81,12 @@ child.expect (COMMAND_PROMPT) print print child.before +# Run netstat +child.sendline ('netstat') +child.expect (COMMAND_PROMPT) +print +print child.before + # Run free. child.sendline ('free') # Linux systems only. child.expect (COMMAND_PROMPT) diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py index 82855ae..c313f46 100644 --- a/pexpect/pexpect.py +++ b/pexpect/pexpect.py @@ -324,6 +324,10 @@ class spawn: r, w, e = select.select([self.child_fd], [], [], timeout) if not r: raise TIMEOUT('Timeout exceeded in read().') +# if not self.isalive(): +# raise EOF ('End of File (EOF) in read(). Really dumb platform.') +# else: +# raise TIMEOUT('Timeout exceeded in read().') if self.child_fd in r: try: |