Fix tty ioctl test for non-tty stdout
This commit is contained in:
		
							parent
							
								
									0ffc127bff
								
							
						
					
					
						commit
						7372d0277c
					
				@ -17,8 +17,14 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int test_tty_ioctl_TIOCGWINSZ(void) {
 | 
					int test_tty_ioctl_TIOCGWINSZ(void) {
 | 
				
			||||||
    struct winsize winsize;
 | 
					    struct winsize winsize;
 | 
				
			||||||
    if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) < 0) {
 | 
					    if (isatty(STDOUT_FILENO)) {
 | 
				
			||||||
        THROW_ERROR("failed to ioctl TIOCGWINSZ");
 | 
					        if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) < 0) {
 | 
				
			||||||
 | 
					            THROW_ERROR("failed to ioctl TIOCGWINSZ");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        // FIXME: /dev/tty should be opened. But it has not been implemented in Occlum yet.
 | 
				
			||||||
 | 
					        // So we just skip this test if STDOUT is redirected.
 | 
				
			||||||
 | 
					        printf("Warning: test_tty_ioctl_TIOCGWINSZ is skipped\n");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user