Fix tty ioctl test for non-tty stdout

This commit is contained in:
Hui, Chunyang 2020-04-13 04:25:25 +00:00
parent 0ffc127bff
commit 7372d0277c

@ -17,9 +17,15 @@
int test_tty_ioctl_TIOCGWINSZ(void) { int test_tty_ioctl_TIOCGWINSZ(void) {
struct winsize winsize; struct winsize winsize;
if (isatty(STDOUT_FILENO)) {
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) < 0) { if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) < 0) {
THROW_ERROR("failed to ioctl TIOCGWINSZ"); 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;
} }