From: ts Date: 2001-05-27T00:44:33+09:00 Subject: [ruby-talk:15766] Re: Disabling stderr >>>>> "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