mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	io/console: support getch timeout on Windows
This commit is contained in:
		
							parent
							
								
									6d733565c2
								
							
						
					
					
						commit
						456586bb23
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		|  | @ -419,7 +419,15 @@ console_getch(int argc, VALUE *argv, VALUE io) | |||
| 
 | ||||
|     GetOpenFile(io, fptr); | ||||
|     if (optp) { | ||||
| 	rb_warning("option ignored"); | ||||
| 	struct timeval *to = NULL, tv; | ||||
| 	if (optp->vtime) { | ||||
| 	    to = &tv; | ||||
| 	    tv.tv_sec = optp->vtime / 10; | ||||
| 	    tv.tv_usec = (optp->vtime % 10) * 100000; | ||||
| 	} | ||||
| 	if (optp->vmin) { | ||||
| 	    rb_warning("min option ignored"); | ||||
| 	} | ||||
|     } | ||||
|     w = rb_wait_for_single_fd(fptr->fd, RB_WAITFD_IN, NULL); | ||||
|     if (w < 0) rb_eof_error(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nobuyoshi Nakada
						Nobuyoshi Nakada