From: matz@... (Yukihiro Matsumoto) Date: 1997-09-10T11:38:00+09:00 Subject: [ruby-dev:445] Re: pipe_list まつもと ゆきひろです In message "[ruby-dev:444] pipe_list" on 97/09/10, WATANABE Hirofumi writes: |わたなべです. | |例の pipe_list ですが, djgpp で試したところ動いたんで, |rbdj0909.zip に入れました(pipe_add_fptr を pipe_open で呼ぶ |ようにした). すみません.pipe_add_fptrが落ちていることに今朝やっと気が付 きました. |ところで, これは stack 構造なので逆順になりますが, そういう |仕様にしますか? あんまり深く考えていませんでした.呼ばれれば良いのだろうし, 正順にするのもいろいろ面倒なので(問題が見つかるまでは)こうい う仕様(というか仕様としては不定で,実装は逆順)で行こうと思い ます. |cygwin32 のほうは popen じゃなくて pipe を使ってるんで大丈夫 |だと思ったんですが, close しないとつまり wait してやらないと |なぜか SEGV になってしまうようです. こちらも list を作らない |とだめかなあ? そうしましょう.__CYGWIN32__が定義されている時にも動くように しました. --- io.c~ Tue Sep 9 18:03:55 1997 +++ io.c Wed Sep 10 11:40:02 1997 @@ -781,3 +781,3 @@ -#if defined (NT) || defined(DJGPP) +#if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) static struct pipe_list { @@ -823,2 +823,14 @@ static void +pipe_atexit() +{ + struct pipe_list *list = pipe_list; + + while (list) { + io_fptr_finalize(list->fptr); + list = list->next; + } +} + +#if !defined (__CYGWIN32__) +static void pipe_finalize(fptr) @@ -835,18 +847,3 @@ } - -static void -pipe_fptr_atexit() -{ - struct pipe_list *list = pipe_list; - - while (list) { - if (list->fptr->f != NULL) { - pclose(list->fptr->f); - } - if (list->fptr->f2 != NULL) { - pclose(list->fptr->f2); - } - list = list->next; - } -} +#endif #endif @@ -882,2 +879,3 @@ + pipe_add_fptr(fptr); if (modef & FMODE_READABLE) fptr->f = f; @@ -2262,4 +2260,4 @@ -#if defined (NT) || defined(DJGPP) - atexit(pipe_fptr_atexit); +#if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) + atexit(pipe_atexit); #endif