Fall back to stdout if tty fails to open

May help with #1477
develop
lethosor 2020-03-28 13:14:03 -04:00
parent b6e0d3f73d
commit 6eb73d9046
1 changed files with 6 additions and 0 deletions

@ -840,6 +840,12 @@ bool Console::init(bool dont_redirect)
if (!freopen("stdout.log", "w", stdout)) if (!freopen("stdout.log", "w", stdout))
; ;
d->dfout_C = fopen("/dev/tty", "w"); d->dfout_C = fopen("/dev/tty", "w");
if (!d->dfout_C)
{
fprintf(stderr, "could not open tty\n");
d->dfout_C = fopen("/dev/stdout", "w");
return false;
}
} }
std::cin.tie(this); std::cin.tie(this);
clear(); clear();