From 845bc5f7ebbc82604edef8ee1359d95cb6819220 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 5 Dec 2013 14:28:39 +0100 Subject: [PATCH] Show fatal exceptions in a message box instead of cerr when running without a terminal --- apps/openmw/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 42815e330b..b1bbb14f23 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -1,7 +1,9 @@ #include +#include #include +#include #include #include "engine.hpp" @@ -280,7 +282,11 @@ int main(int argc, char**argv) } catch (std::exception &e) { - std::cout << "\nERROR: " << e.what() << std::endl; + if (isatty(fileno(stdin))) + std::cerr << "\nERROR: " << e.what() << std::endl; + else + SDL_ShowSimpleMessageBox(0, "OpenMW: Fatal error", e.what(), NULL); + return 1; }