From: Hidetoshi NAGAI Date: 2003-11-01T11:28:27+09:00 Subject: [ruby-dev:21801] Re: ruby-tk hangs when exception is raised 永井@知能.九工大です. From: Hidetoshi NAGAI Subject: [ruby-dev:21797] Re: ruby-tk hangs when exception is raised Date: Fri, 31 Oct 2003 17:32:15 +0900 Message-ID: <20031031.173214.74741993.nagai@ai.kyutech.ac.jp> > 困ったことに,同じスクリプトを IRB の中から動かすと > 問題が起きないようなのです. > もしかしたら,このあたりに解決の糸口があるのかもしれませんが, > 私が IRB の中身を理解できていないので, > その糸を引っ張り出すことができないでいます. なんとか引っ張り出せたような気がします. どうやら, ----< man signal より >-------------------------------------- According to POSIX (3.3.1.3) it is unspecified what happens when SIGCHLD is set to SIG_IGN. Here the BSD and SYSV behaviours differ, causing BSD software that sets the action for SIGCHLD to SIG_IGN to fail on Linux. ------------------------------------------------------------- がトラブルに絡んでいたように見えます. 添付のパッチを試してみていただけませんか? -- 永井 秀利 (九工大 知能情報) nagai@ai.kyutech.ac.jp Index: tcltklib.c =================================================================== RCS file: /src/ruby/ext/tcltklib/tcltklib.c,v retrieving revision 1.45 diff -u -r1.45 tcltklib.c --- tcltklib.c 29 Oct 2003 11:03:54 -0000 1.45 +++ tcltklib.c 1 Nov 2003 02:19:42 -0000 @@ -3,9 +3,9 @@ * Aug. 27, 1997 Y. Shigehiro * Oct. 24, 1997 Y. Matsumoto */ - #include "ruby.h" #include "rubysig.h" +#include #undef EXTERN /* avoid conflict with tcl.h of tcl8.2 or before */ #include #ifdef HAVE_STDARG_PROTOTYPES @@ -2153,6 +2153,25 @@ VALUE ip = rb_define_class("TclTkIp", rb_cObject); VALUE ev_flag = rb_define_module_under(lib, "EventFlag"); + + VALUE oldsig; + +#ifndef MACOS_UNUSE_SIGNAL +#ifdef SIGCLD + oldsig = rb_funcall(rb_mKernel, rb_intern("trap"), 2, + INT2FIX(SIGCLD), rb_str_new2("SIG_DFL")); + if (oldsig != Qnil) { + rb_funcall(rb_mKernel, rb_intern("trap"), 2, INT2FIX(SIGCLD), oldsig); + } +#endif +#ifdef SIGCHLD + oldsig = rb_funcall(rb_mKernel, rb_intern("trap"), 2, + INT2FIX(SIGCHLD), rb_str_new2("SIG_DFL")); + if (oldsig != Qnil) { + rb_funcall(rb_mKernel, rb_intern("trap"), 2, INT2FIX(SIGCHLD), oldsig); + } +#endif +#endif #if defined USE_TCL_STUBS && defined USE_TK_STUBS extern int ruby_tcltk_stubs();