Redirect stdout to /dev/null when using console=false

This commit is contained in:
Inori 2019-09-06 13:03:14 -04:00 committed by Inori
parent 147dc4dab0
commit 2724934436

View file

@ -715,8 +715,10 @@ static void mriBindingExecute()
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));
VALUE iostr = rb_str_new2(NULL_IO);
// Sysinit isn't a thing yet, so send io to /dev/null instead
rb_funcall(rb_gv_get("$stderr"), rb_intern("reopen"), 1, iostr);
rb_funcall(rb_gv_get("$stdout"), rb_intern("reopen"), 1, iostr);
#endif
#endif