os_unix.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. /**************************************************************************/
  2. /* os_unix.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "os_unix.h"
  31. #ifdef UNIX_ENABLED
  32. #include "core/project_settings.h"
  33. #include "drivers/unix/dir_access_unix.h"
  34. #include "drivers/unix/file_access_unix.h"
  35. #include "drivers/unix/net_socket_posix.h"
  36. #include "drivers/unix/thread_posix.h"
  37. #include "servers/visual_server.h"
  38. #ifdef __APPLE__
  39. #include <mach-o/dyld.h>
  40. #include <mach/mach_time.h>
  41. #endif
  42. #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
  43. #include <sys/param.h>
  44. #include <sys/sysctl.h>
  45. #endif
  46. #include <assert.h>
  47. #include <dlfcn.h>
  48. #include <errno.h>
  49. #include <poll.h>
  50. #include <signal.h>
  51. #include <stdarg.h>
  52. #include <stdio.h>
  53. #include <stdlib.h>
  54. #include <string.h>
  55. #include <sys/time.h>
  56. #include <sys/wait.h>
  57. #include <time.h>
  58. #include <unistd.h>
  59. /// Clock Setup function (used by get_ticks_usec)
  60. static uint64_t _clock_start = 0;
  61. #if defined(__APPLE__)
  62. static double _clock_scale = 0;
  63. static void _setup_clock() {
  64. mach_timebase_info_data_t info;
  65. kern_return_t ret = mach_timebase_info(&info);
  66. ERR_FAIL_COND_MSG(ret != 0, "OS CLOCK IS NOT WORKING!");
  67. _clock_scale = ((double)info.numer / (double)info.denom) / 1000.0;
  68. _clock_start = mach_absolute_time() * _clock_scale;
  69. }
  70. #else
  71. #if defined(CLOCK_MONOTONIC_RAW) && !defined(JAVASCRIPT_ENABLED) // This is a better clock on Linux.
  72. #define GODOT_CLOCK CLOCK_MONOTONIC_RAW
  73. #else
  74. #define GODOT_CLOCK CLOCK_MONOTONIC
  75. #endif
  76. static void _setup_clock() {
  77. struct timespec tv_now = { 0, 0 };
  78. ERR_FAIL_COND_MSG(clock_gettime(GODOT_CLOCK, &tv_now) != 0, "OS CLOCK IS NOT WORKING!");
  79. _clock_start = ((uint64_t)tv_now.tv_nsec / 1000L) + (uint64_t)tv_now.tv_sec * 1000000L;
  80. }
  81. #endif
  82. void OS_Unix::debug_break() {
  83. assert(false);
  84. };
  85. static void handle_interrupt(int sig) {
  86. if (ScriptDebugger::get_singleton() == nullptr) {
  87. return;
  88. }
  89. ScriptDebugger::get_singleton()->set_depth(-1);
  90. ScriptDebugger::get_singleton()->set_lines_left(1);
  91. }
  92. void OS_Unix::initialize_debugging() {
  93. if (ScriptDebugger::get_singleton() != nullptr) {
  94. struct sigaction action;
  95. memset(&action, 0, sizeof(action));
  96. action.sa_handler = handle_interrupt;
  97. sigaction(SIGINT, &action, nullptr);
  98. }
  99. }
  100. int OS_Unix::unix_initialize_audio(int p_audio_driver) {
  101. return 0;
  102. }
  103. void OS_Unix::initialize_core() {
  104. #if !defined(NO_THREADS)
  105. init_thread_posix();
  106. #endif
  107. FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
  108. FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
  109. FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
  110. DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_RESOURCES);
  111. DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_USERDATA);
  112. DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_FILESYSTEM);
  113. #ifndef NO_NETWORK
  114. NetSocketPosix::make_default();
  115. IP_Unix::make_default();
  116. #endif
  117. _setup_clock();
  118. }
  119. void OS_Unix::finalize_core() {
  120. NetSocketPosix::cleanup();
  121. }
  122. void OS_Unix::alert(const String &p_alert, const String &p_title) {
  123. fprintf(stderr, "ALERT: %s: %s\n", p_title.utf8().get_data(), p_alert.utf8().get_data());
  124. }
  125. String OS_Unix::get_stdin_string(bool p_block) {
  126. if (p_block) {
  127. char buff[1024];
  128. String ret = stdin_buf + fgets(buff, 1024, stdin);
  129. stdin_buf = "";
  130. return ret;
  131. }
  132. return "";
  133. }
  134. String OS_Unix::get_name() const {
  135. return "Unix";
  136. }
  137. uint64_t OS_Unix::get_unix_time() const {
  138. return time(nullptr);
  139. };
  140. uint64_t OS_Unix::get_system_time_secs() const {
  141. struct timeval tv_now;
  142. gettimeofday(&tv_now, nullptr);
  143. return uint64_t(tv_now.tv_sec);
  144. }
  145. uint64_t OS_Unix::get_system_time_msecs() const {
  146. struct timeval tv_now;
  147. gettimeofday(&tv_now, nullptr);
  148. return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000;
  149. }
  150. double OS_Unix::get_subsecond_unix_time() const {
  151. struct timeval tv_now;
  152. gettimeofday(&tv_now, nullptr);
  153. return (double)tv_now.tv_sec + double(tv_now.tv_usec) / 1000000;
  154. }
  155. OS::Date OS_Unix::get_date(bool utc) const {
  156. time_t t = time(nullptr);
  157. struct tm lt;
  158. if (utc) {
  159. gmtime_r(&t, &lt);
  160. } else {
  161. localtime_r(&t, &lt);
  162. }
  163. Date ret;
  164. ret.year = 1900 + lt.tm_year;
  165. // Index starting at 1 to match OS_Unix::get_date
  166. // and Windows SYSTEMTIME and tm_mon follows the typical structure
  167. // of 0-11, noted here: http://www.cplusplus.com/reference/ctime/tm/
  168. ret.month = (Month)(lt.tm_mon + 1);
  169. ret.day = lt.tm_mday;
  170. ret.weekday = (Weekday)lt.tm_wday;
  171. ret.dst = lt.tm_isdst;
  172. return ret;
  173. }
  174. OS::Time OS_Unix::get_time(bool utc) const {
  175. time_t t = time(nullptr);
  176. struct tm lt;
  177. if (utc) {
  178. gmtime_r(&t, &lt);
  179. } else {
  180. localtime_r(&t, &lt);
  181. }
  182. Time ret;
  183. ret.hour = lt.tm_hour;
  184. ret.min = lt.tm_min;
  185. ret.sec = lt.tm_sec;
  186. get_time_zone_info();
  187. return ret;
  188. }
  189. OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
  190. time_t t = time(nullptr);
  191. struct tm lt;
  192. localtime_r(&t, &lt);
  193. char name[16];
  194. strftime(name, 16, "%Z", &lt);
  195. name[15] = 0;
  196. TimeZoneInfo ret;
  197. ret.name = name;
  198. char bias_buf[16];
  199. strftime(bias_buf, 16, "%z", &lt);
  200. int bias;
  201. bias_buf[15] = 0;
  202. sscanf(bias_buf, "%d", &bias);
  203. // convert from ISO 8601 (1 minute=1, 1 hour=100) to minutes
  204. int hour = (int)bias / 100;
  205. int minutes = bias % 100;
  206. if (bias < 0) {
  207. ret.bias = hour * 60 - minutes;
  208. } else {
  209. ret.bias = hour * 60 + minutes;
  210. }
  211. return ret;
  212. }
  213. void OS_Unix::delay_usec(uint32_t p_usec) const {
  214. struct timespec requested = { static_cast<time_t>(p_usec / 1000000), (static_cast<long>(p_usec) % 1000000) * 1000 };
  215. struct timespec remaining;
  216. while (nanosleep(&requested, &remaining) == -1 && errno == EINTR) {
  217. requested.tv_sec = remaining.tv_sec;
  218. requested.tv_nsec = remaining.tv_nsec;
  219. }
  220. }
  221. uint64_t OS_Unix::get_ticks_usec() const {
  222. #if defined(__APPLE__)
  223. uint64_t longtime = mach_absolute_time() * _clock_scale;
  224. #else
  225. // Unchecked return. Static analyzers might complain.
  226. // If _setup_clock() succeeded, we assume clock_gettime() works.
  227. struct timespec tv_now = { 0, 0 };
  228. clock_gettime(GODOT_CLOCK, &tv_now);
  229. uint64_t longtime = ((uint64_t)tv_now.tv_nsec / 1000L) + (uint64_t)tv_now.tv_sec * 1000000L;
  230. #endif
  231. longtime -= _clock_start;
  232. return longtime;
  233. }
  234. Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex, bool p_open_console) {
  235. #ifdef __EMSCRIPTEN__
  236. // Don't compile this code at all to avoid undefined references.
  237. // Actual virtual call goes to OS_JavaScript.
  238. ERR_FAIL_V(ERR_BUG);
  239. #else
  240. if (p_blocking && r_pipe) {
  241. String argss;
  242. argss = "\"" + p_path + "\"";
  243. for (int i = 0; i < p_arguments.size(); i++) {
  244. argss += String(" \"") + p_arguments[i] + "\"";
  245. }
  246. if (read_stderr) {
  247. argss += " 2>&1"; // Read stderr too
  248. } else {
  249. argss += " 2>/dev/null"; //silence stderr
  250. }
  251. FILE *f = popen(argss.utf8().get_data(), "r");
  252. ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot pipe stream from process running with following arguments '" + argss + "'.");
  253. char buf[65535];
  254. while (fgets(buf, 65535, f)) {
  255. if (p_pipe_mutex) {
  256. p_pipe_mutex->lock();
  257. }
  258. (*r_pipe) += String::utf8(buf);
  259. if (p_pipe_mutex) {
  260. p_pipe_mutex->unlock();
  261. }
  262. }
  263. int rv = pclose(f);
  264. if (r_exitcode) {
  265. *r_exitcode = WEXITSTATUS(rv);
  266. }
  267. return OK;
  268. }
  269. pid_t pid = fork();
  270. ERR_FAIL_COND_V(pid < 0, ERR_CANT_FORK);
  271. if (pid == 0) {
  272. // is child
  273. if (!p_blocking) {
  274. // For non blocking calls, create a new session-ID so parent won't wait for it.
  275. // This ensures the process won't go zombie at end.
  276. setsid();
  277. }
  278. Vector<CharString> cs;
  279. cs.push_back(p_path.utf8());
  280. for (int i = 0; i < p_arguments.size(); i++) {
  281. cs.push_back(p_arguments[i].utf8());
  282. }
  283. Vector<char *> args;
  284. for (int i = 0; i < cs.size(); i++) {
  285. args.push_back((char *)cs[i].get_data());
  286. }
  287. args.push_back(0);
  288. execvp(p_path.utf8().get_data(), &args[0]);
  289. // still alive? something failed..
  290. fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data());
  291. raise(SIGKILL);
  292. }
  293. if (p_blocking) {
  294. int status;
  295. waitpid(pid, &status, 0);
  296. if (r_exitcode) {
  297. *r_exitcode = WIFEXITED(status) ? WEXITSTATUS(status) : status;
  298. }
  299. } else {
  300. if (r_child_id) {
  301. *r_child_id = pid;
  302. }
  303. }
  304. return OK;
  305. #endif
  306. }
  307. Error OS_Unix::kill(const ProcessID &p_pid) {
  308. int ret = ::kill(p_pid, SIGKILL);
  309. if (!ret) {
  310. //avoid zombie process
  311. int st;
  312. ::waitpid(p_pid, &st, 0);
  313. }
  314. return ret ? ERR_INVALID_PARAMETER : OK;
  315. }
  316. int OS_Unix::get_process_id() const {
  317. return getpid();
  318. };
  319. bool OS_Unix::is_process_running(const ProcessID &p_pid) const {
  320. int status = 0;
  321. if (waitpid(p_pid, &status, WNOHANG) != 0) {
  322. return false;
  323. }
  324. return true;
  325. }
  326. bool OS_Unix::has_environment(const String &p_var) const {
  327. return getenv(p_var.utf8().get_data()) != nullptr;
  328. }
  329. String OS_Unix::get_locale() const {
  330. if (!has_environment("LANG")) {
  331. return "en";
  332. }
  333. String locale = get_environment("LANG");
  334. int tp = locale.find(".");
  335. if (tp != -1) {
  336. locale = locale.substr(0, tp);
  337. }
  338. return locale;
  339. }
  340. Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
  341. String path = p_path;
  342. if (FileAccess::exists(path) && path.is_rel_path()) {
  343. // dlopen expects a slash, in this case a leading ./ for it to be interpreted as a relative path,
  344. // otherwise it will end up searching various system directories for the lib instead and finally failing.
  345. path = "./" + path;
  346. }
  347. if (!FileAccess::exists(path)) {
  348. //this code exists so gdnative can load .so files from within the executable path
  349. path = get_executable_path().get_base_dir().plus_file(p_path.get_file());
  350. }
  351. if (!FileAccess::exists(path)) {
  352. //this code exists so gdnative can load .so files from a standard unix location
  353. path = get_executable_path().get_base_dir().plus_file("../lib").plus_file(p_path.get_file());
  354. }
  355. p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
  356. ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ". Error: " + dlerror());
  357. return OK;
  358. }
  359. Error OS_Unix::close_dynamic_library(void *p_library_handle) {
  360. if (dlclose(p_library_handle)) {
  361. return FAILED;
  362. }
  363. return OK;
  364. }
  365. Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
  366. const char *error;
  367. dlerror(); // Clear existing errors
  368. p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data());
  369. error = dlerror();
  370. if (error != nullptr) {
  371. ERR_FAIL_COND_V_MSG(!p_optional, ERR_CANT_RESOLVE, "Can't resolve symbol " + p_name + ". Error: " + error + ".");
  372. return ERR_CANT_RESOLVE;
  373. }
  374. return OK;
  375. }
  376. Error OS_Unix::set_cwd(const String &p_cwd) {
  377. if (chdir(p_cwd.utf8().get_data()) != 0) {
  378. return ERR_CANT_OPEN;
  379. }
  380. return OK;
  381. }
  382. String OS_Unix::get_environment(const String &p_var) const {
  383. if (getenv(p_var.utf8().get_data())) {
  384. return getenv(p_var.utf8().get_data());
  385. }
  386. return "";
  387. }
  388. bool OS_Unix::set_environment(const String &p_var, const String &p_value) const {
  389. return setenv(p_var.utf8().get_data(), p_value.utf8().get_data(), /* overwrite: */ true) == 0;
  390. }
  391. int OS_Unix::get_processor_count() const {
  392. return sysconf(_SC_NPROCESSORS_CONF);
  393. }
  394. String OS_Unix::get_user_data_dir() const {
  395. String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name"));
  396. if (appname != "") {
  397. bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir");
  398. if (use_custom_dir) {
  399. String custom_dir = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/custom_user_dir_name"), true);
  400. if (custom_dir == "") {
  401. custom_dir = appname;
  402. }
  403. return get_data_path().plus_file(custom_dir);
  404. } else {
  405. return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname);
  406. }
  407. }
  408. return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file("[unnamed project]");
  409. }
  410. String OS_Unix::get_executable_path() const {
  411. #ifdef __linux__
  412. //fix for running from a symlink
  413. char buf[256];
  414. memset(buf, 0, 256);
  415. ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
  416. String b;
  417. if (len > 0) {
  418. b.parse_utf8(buf, len);
  419. }
  420. if (b == "") {
  421. WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
  422. return OS::get_executable_path();
  423. }
  424. return b;
  425. #elif defined(__OpenBSD__) || defined(__NetBSD__)
  426. char resolved_path[MAXPATHLEN];
  427. realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
  428. return String(resolved_path);
  429. #elif defined(__FreeBSD__)
  430. int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
  431. char buf[MAXPATHLEN];
  432. size_t len = sizeof(buf);
  433. if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) {
  434. WARN_PRINT("Couldn't get executable path from sysctl");
  435. return OS::get_executable_path();
  436. }
  437. String b;
  438. b.parse_utf8(buf);
  439. return b;
  440. #elif defined(__APPLE__)
  441. char temp_path[1];
  442. uint32_t buff_size = 1;
  443. _NSGetExecutablePath(temp_path, &buff_size);
  444. char *resolved_path = new char[buff_size + 1];
  445. if (_NSGetExecutablePath(resolved_path, &buff_size) == 1)
  446. WARN_PRINT("MAXPATHLEN is too small");
  447. String path(resolved_path);
  448. delete[] resolved_path;
  449. return path;
  450. #else
  451. ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly.");
  452. return OS::get_executable_path();
  453. #endif
  454. }
  455. void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
  456. if (!should_log(true)) {
  457. return;
  458. }
  459. const char *err_details;
  460. if (p_rationale && p_rationale[0]) {
  461. err_details = p_rationale;
  462. } else {
  463. err_details = p_code;
  464. }
  465. // Disable color codes if stdout is not a TTY.
  466. // This prevents Godot from writing ANSI escape codes when redirecting
  467. // stdout and stderr to a file.
  468. const bool tty = isatty(fileno(stdout));
  469. const char *gray = tty ? "\E[0;90m" : "";
  470. const char *red = tty ? "\E[0;91m" : "";
  471. const char *red_bold = tty ? "\E[1;31m" : "";
  472. const char *yellow = tty ? "\E[0;93m" : "";
  473. const char *yellow_bold = tty ? "\E[1;33m" : "";
  474. const char *magenta = tty ? "\E[0;95m" : "";
  475. const char *magenta_bold = tty ? "\E[1;35m" : "";
  476. const char *cyan = tty ? "\E[0;96m" : "";
  477. const char *cyan_bold = tty ? "\E[1;36m" : "";
  478. const char *reset = tty ? "\E[0m" : "";
  479. switch (p_type) {
  480. case ERR_WARNING:
  481. logf_error("%sWARNING:%s %s\n", yellow_bold, yellow, err_details);
  482. logf_error("%s at: %s (%s:%i)%s\n", gray, p_function, p_file, p_line, reset);
  483. break;
  484. case ERR_SCRIPT:
  485. logf_error("%sSCRIPT ERROR:%s %s\n", magenta_bold, magenta, err_details);
  486. logf_error("%s at: %s (%s:%i)%s\n", gray, p_function, p_file, p_line, reset);
  487. break;
  488. case ERR_SHADER:
  489. logf_error("%sSHADER ERROR:%s %s\n", cyan_bold, cyan, err_details);
  490. logf_error("%s at: %s (%s:%i)%s\n", gray, p_function, p_file, p_line, reset);
  491. break;
  492. case ERR_ERROR:
  493. default:
  494. logf_error("%sERROR:%s %s\n", red_bold, red, err_details);
  495. logf_error("%s at: %s (%s:%i)%s\n", gray, p_function, p_file, p_line, reset);
  496. break;
  497. }
  498. }
  499. UnixTerminalLogger::~UnixTerminalLogger() {}
  500. OS_Unix::OS_Unix() {
  501. Vector<Logger *> loggers;
  502. loggers.push_back(memnew(UnixTerminalLogger));
  503. _set_logger(memnew(CompositeLogger(loggers)));
  504. }
  505. #endif