Issue 406: Keep FileDesc alive long enough for ioctl to work (#413)
This commit is contained in:
		
							parent
							
								
									e61320ef32
								
							
						
					
					
						commit
						1dd20f3ada
					
				@ -32,8 +32,9 @@ pub(crate) fn size() -> Result<(u16, u16)> {
 | 
				
			|||||||
        ws_ypixel: 0,
 | 
					        ws_ypixel: 0,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let fd = if let Ok(file) = File::open("/dev/tty") {
 | 
					    let file = File::open("/dev/tty").map(|file| (FileDesc::new(file.into_raw_fd(), true)));
 | 
				
			||||||
        FileDesc::new(file.into_raw_fd(), true).raw_fd()
 | 
					    let fd = if let Ok(file) = &file {
 | 
				
			||||||
 | 
					        file.raw_fd()
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        // Fallback to libc::STDOUT_FILENO if /dev/tty is missing
 | 
					        // Fallback to libc::STDOUT_FILENO if /dev/tty is missing
 | 
				
			||||||
        STDOUT_FILENO
 | 
					        STDOUT_FILENO
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user