From 83a90a9133d6cd36c2607775328fc0de4ee202c3 Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Mon, 9 Feb 2015 15:26:25 +0000 Subject: [PATCH] Fixed infinite loop when nightly tests crash while std::cin is attached to /dev/null Signed-off-by: Christoph M. Wintersteiger --- src/util/debug.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/debug.cpp b/src/util/debug.cpp index c336ddb73..54c67feca 100644 --- a/src/util/debug.cpp +++ b/src/util/debug.cpp @@ -76,7 +76,8 @@ void invoke_gdb() { for (;;) { std::cerr << "(C)ontinue, (A)bort, (S)top, (T)hrow exception, Invoke (G)DB\n"; char result; - std::cin >> result; + bool ok = (std::cin >> result); + if (!ok) exit(ERR_INTERNAL_FATAL); // happens if std::cin is eof or unattached. switch(result) { case 'C': case 'c':