mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									588f38ec2a
								
							
						
					
					
						commit
						5baf4bc978
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -376,9 +376,6 @@ def interact(self): | ||||||
| 	"""Interaction function, emulates a very dumb telnet client.""" | 	"""Interaction function, emulates a very dumb telnet client.""" | ||||||
| 	while 1: | 	while 1: | ||||||
| 	    rfd, wfd, xfd = select.select([self, sys.stdin], [], []) | 	    rfd, wfd, xfd = select.select([self, sys.stdin], [], []) | ||||||
| 	    if sys.stdin in rfd: |  | ||||||
| 		line = sys.stdin.readline() |  | ||||||
| 		self.write(line) |  | ||||||
| 	    if self in rfd: | 	    if self in rfd: | ||||||
| 		try: | 		try: | ||||||
| 		    text = self.read_eager() | 		    text = self.read_eager() | ||||||
|  | @ -388,7 +385,11 @@ def interact(self): | ||||||
| 		if text: | 		if text: | ||||||
| 		    sys.stdout.write(text) | 		    sys.stdout.write(text) | ||||||
| 		    sys.stdout.flush() | 		    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): |     def expect(self, list, timeout=None): | ||||||
| 	"""Read until one from a list of a regular expressions matches. | 	"""Read until one from a list of a regular expressions matches. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum