summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoah <noah@656d521f-e311-0410-88e0-e7920216d269>2004-03-05 16:51:23 +0000
committernoah <noah@656d521f-e311-0410-88e0-e7920216d269>2004-03-05 16:51:23 +0000
commitcf3bb75de99bc1f8e50e4d7b9eb203d8cca33263 (patch)
tree40c67e542a625078861b4224e728b7a950cb04e3
parent962918612a1fcddb56acc3589120c317fa37904c (diff)
downloadpexpect-cf3bb75de99bc1f8e50e4d7b9eb203d8cca33263.tar.gz
Added netstat to monitor example.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@218 656d521f-e311-0410-88e0-e7920216d269
-rwxr-xr-xpexpect/examples/monitor.py7
-rw-r--r--pexpect/pexpect.py4
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: