From: Shoichi OZAWA Date: 1998-09-17T13:29:39+09:00 Subject: [ruby-list:9587] Re: filter こんにちは 小澤@日立 です。 In message "Re: filter" on 98/09/17, Yukihiro Matsumoto writes: > まつもと ゆきひろです [...] > ないです.open3相当のものを自作する必要があるでしょう.標準 > ライブラリに含まれているべきのような気はします. まえに open3 相当のものを作ったので、下につけときます。 ただ、1.0 のころに作ったんで、今動くかどうかわかりません。 -----ここから----- module Open3 #[stdin, stdout, stderr] = popen3(command); def popen3(cmd) pw = pipe # pipe[0] for read, pipe[1] for write pr = pipe pe = pipe pid = fork if pid == nil then # child pw[1].close STDIN.reopen(pw[0]) pw[0].close pr[0].close STDOUT.reopen(pr[1]) pr[1].close pe[0].close STDERR.reopen(pe[1]) pe[1].close exec(cmd) exit else pw[0].close pr[1].close pe[1].close pi = [ pw[1], pr[0], pe[0] ] end end end -----ここまで----- ではでは。 -- 小澤 彰一 keep it simple, stupid. ozawa@omika.hitachi.co.jp