diff options
author | Guido van Rossum <guido@python.org> | 1997-12-29 20:05:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-12-29 20:05:45 (GMT) |
commit | 5baf4bc97863dc2a5e89ca22ac73bdbf34dff925 (patch) | |
tree | 84ea193a102dd2e68d067f4225fd015b23fe1303 /Lib/telnetlib.py | |
parent | 588f38ec2acf8b912bac65167f9e4507e9907767 (diff) | |
download | cpython-5baf4bc97863dc2a5e89ca22ac73bdbf34dff925.zip cpython-5baf4bc97863dc2a5e89ca22ac73bdbf34dff925.tar.gz cpython-5baf4bc97863dc2a5e89ca22ac73bdbf34dff925.tar.bz2 |
Moved things around a bit in interact(), so outout is processed before
input. When an EOF is read, break out of the loop instead of (by
default) writing an empty line (which doesn't do much good). Don't
close self when falling through the loop.
Diffstat (limited to 'Lib/telnetlib.py')
-rw-r--r-- | Lib/telnetlib.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py index 1a1c75e..4784a69 100644 --- a/Lib/telnetlib.py +++ b/Lib/telnetlib.py @@ -376,9 +376,6 @@ class Telnet: """Interaction function, emulates a very dumb telnet client.""" while 1: rfd, wfd, xfd = select.select([self, sys.stdin], [], []) - if sys.stdin in rfd: - line = sys.stdin.readline() - self.write(line) if self in rfd: try: text = self.read_eager() @@ -388,7 +385,11 @@ class Telnet: if text: sys.stdout.write(text) sys.stdout.flush() - self.close() + if sys.stdin in rfd: + line = sys.stdin.readline() + if not line: + break + self.write(line) def expect(self, list, timeout=None): """Read until one from a list of a regular expressions matches. |