Make sure readline has been imported before duping any stdio handles--otherwise pyreadline fails to connect to the correct handle for the console's stdout/in.
This commit is contained in:
		
							parent
							
								
									cd3a441304
								
							
						
					
					
						commit
						924a9667e1
					
				|  | @ -308,6 +308,14 @@ class FDCapture: | ||||||
|     """ Capture IO to/from a given os-level filedescriptor. """ |     """ Capture IO to/from a given os-level filedescriptor. """ | ||||||
| 
 | 
 | ||||||
|     def __init__(self, targetfd, tmpfile=None): |     def __init__(self, targetfd, tmpfile=None): | ||||||
|  |         # ensure readline is imported so that it attaches to the correct | ||||||
|  |         # stdio handles on Windows | ||||||
|  |         if targetfd in (0, 1, 2): | ||||||
|  |             try: | ||||||
|  |                 import readline | ||||||
|  |             except ImportError: | ||||||
|  |                 pass | ||||||
|  | 
 | ||||||
|         self.targetfd = targetfd |         self.targetfd = targetfd | ||||||
|         try: |         try: | ||||||
|             self.targetfd_save = os.dup(self.targetfd) |             self.targetfd_save = os.dup(self.targetfd) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue