From: aito@... Date: 1998-10-17T00:06:01+09:00 Subject: [ruby-list:10155] pty あ伊藤です. 唐突ですが,pty 用の拡張モジュールを書いてみました. (skkfep の該当部分をほぼそのまま移植しただけですが) 使ってみたい方はいらっしゃいますか? ちなみに script はこんな風に書けます. require 'pty' if ARGV.size == 0 then ofile = "typescript" else ofile = ARGV[0] end logfile = File.open(ofile,"a") r_pty,w_pty = getpty("/bin/csh") system "stty -echo raw" Thread.new do while true w_pty.print STDIN.getc.chr w_pty.flush end end begin while true c = r_pty.getc next if c.nil? print c.chr STDOUT.flush logfile.print c end rescue print $@,':',$!,"\n" logfile.close system "stty echo -raw" exit end ところでこの拡張モジュールですが,fork して exec するときに その exec に失敗したときの処理がうまくできていません. このへんに詳しい方のアドバイスがあるとうれしいのですが. -- aito