diff --git a/library/Console-linux.cpp b/library/Console-linux.cpp index a1ebfad36..6b4de736d 100644 --- a/library/Console-linux.cpp +++ b/library/Console-linux.cpp @@ -716,6 +716,8 @@ void Console::add_text(color_value color, const std::string &text) lock_guard g(*wlock); if (inited) d->print_text(color, text); + else + fwrite(text.data(), 1, text.size(), stderr); } int Console::get_columns(void) diff --git a/library/Core.cpp b/library/Core.cpp index a1090450f..3a75991c1 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -811,14 +811,19 @@ bool Core::Init() } cerr << "Version: " << vinfo->getVersion() << endl; + // Init global object pointers + df::global::InitGlobals(); + cerr << "Initializing Console.\n"; // init the console. bool is_text_mode = false; if(init && init->display.flag.is_set(init_display_flags::TEXT)) { is_text_mode = true; + con.init(true); + cerr << "Console is not available. Use dfhack-run to send commands.\n"; } - if(con.init(is_text_mode)) + else if(con.init(false)) cerr << "Console is running.\n"; else fatal ("Console has failed to initialize!\n", false); @@ -833,7 +838,6 @@ bool Core::Init() */ // initialize data defs virtual_identity::Init(this); - df::global::InitGlobals(); // initialize common lua context Lua::Core::Init(con); @@ -843,12 +847,15 @@ bool Core::Init() cerr << "Initializing Plugins.\n"; // create plugin manager plug_mgr = new PluginManager(this); - cerr << "Starting IO thread.\n"; - // create IO thread IODATA *temp = new IODATA; temp->core = this; temp->plug_mgr = plug_mgr; - thread * IO = new thread(fIOthread, (void *) temp); + if (!is_text_mode) + { + cerr << "Starting IO thread.\n"; + // create IO thread + thread * IO = new thread(fIOthread, (void *) temp); + } cerr << "Starting DF input capture thread.\n"; // set up hotkey capture HotkeyMutex = new mutex();