From: Tom Spilman Date: 2001-05-27T04:10:05+09:00 Subject: [ruby-talk:15770] Re: Disabling stderr > Just use rb_eval_string_protect() I wasn't aware of 'rb_eval_string_protect' and it seems that when it's used that the compiler errors are not output to stderr. Thanks! Tom "ts" wrote in message news:200105261542.f4QFg0507925@orsay1.moulon.inra.fr... > >>>>> "T" == Tom Spilman writes: > > T> I've got a adequate fix that will work for me for now, but i'd really > T> like to see this behavior controllable thru the ruby api. What i've done is > T> wrap the call to 'rb_eval_string'... > > Just use rb_eval_string_protect() > > pigeon% cat tt.c > #include > > static VALUE > tt(obj, str) > VALUE obj, str; > { > VALUE result; > int state = 0; > > result = rb_eval_string_protect(RSTRING(str)->ptr, &state); > if (state) { > result = rb_inspect(rb_gv_get("$!")); > } > return result; > } > > void Init_tt() > { > rb_define_global_function("cex", tt, 1); > } > pigeon% > > pigeon% ruby -rtt -e 'cex "def a"' > pigeon% > > > Guy Decoux > >