mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	[ruby/irb] Change StdioInputMethod#eof? to non-blocking
This fixes --inf-ruby-mode.
0e4a818955
			
			
This commit is contained in:
		
							parent
							
								
									129ecb43e5
								
							
						
					
					
						commit
						28e9344fa4
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		|  | @ -83,7 +83,15 @@ module IRB | |||
|     # | ||||
|     # See IO#eof? for more information. | ||||
|     def eof? | ||||
|       @stdin.eof? | ||||
|       rs, = IO.select([@stdin], [], [], 0.00001) | ||||
|       if rs and rs[0] | ||||
|         c = @stdin.getc | ||||
|         result = c.nil? ? true : false | ||||
|         @stdin.ungetc(c) unless c.nil? | ||||
|         result | ||||
|       else # buffer is empty | ||||
|         false | ||||
|       end | ||||
|     end | ||||
| 
 | ||||
|     # Whether this input method is still readable when there is no more data to | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 aycabta
						aycabta