From 6eb73d9046b8d122f8a402ebefe6dc0de768dfc8 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 28 Mar 2020 13:14:03 -0400 Subject: [PATCH] Fall back to stdout if tty fails to open May help with #1477 --- library/Console-posix.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/Console-posix.cpp b/library/Console-posix.cpp index 344f3642c..6fb1cbff3 100644 --- a/library/Console-posix.cpp +++ b/library/Console-posix.cpp @@ -840,6 +840,12 @@ bool Console::init(bool dont_redirect) if (!freopen("stdout.log", "w", stdout)) ; 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); clear();