Silence stderr if built without console

This commit is contained in:
Inori 2019-08-10 04:35:37 -04:00
parent 261af9efe0
commit 6b102c1772
2 changed files with 16 additions and 2 deletions

View file

@ -43,6 +43,12 @@
#include <SDL_filesystem.h>
#ifdef __WIN32__
#define NULL_IO "NUL"
#else
#define NULL_IO "/dev/null"
#endif
extern const char module_rpg1[];
extern const char module_rpg2[];
extern const char module_rpg3[];
@ -616,6 +622,10 @@ static void mriBindingExecute()
#else
ruby_init();
rb_eval_string("$KCODE='U'");
#ifdef NO_CONSOLE
// Sysinit isn't a thing yet, so send stderr to /dev/null instead
rb_funcall(rb_gv_get("$stderr"), rb_intern("reopen"), 1, rb_str_new2(NULL_IO));
#endif
#endif
Config &conf = shState->rtData().config;

View file

@ -4,14 +4,18 @@ xxd = find_program('xxd', native: true)
host_system = host_machine.system()
compiler = meson.get_compiler('cpp')
if get_option('workdir_current') == true
if get_option('workdir_current')
add_project_arguments('-DWORKDIR_CURRENT', language: 'cpp')
endif
if get_option('fix_essentials') == true
if get_option('fix_essentials')
add_project_arguments('-DUSE_ESSENTIALS_FIXES', language: 'cpp')
endif
if not get_option('console')
add_project_arguments('-DNO_CONSOLE', language: 'cpp')
endif
subdir('src')
subdir('binding')
subdir('shader')