From: SATOH Fumiyasu Date: 2008-03-17T19:43:12+09:00 Subject: [ruby-list:44782] $stdin.rewind が exec した子プロセスに伝わらない? さとうふみやす @ OSS テクノロジです。 $stdin.rewind したとき、その後に ruby から実行する 外部コマンドに反映されないことがあるのですが、バグでしょうか? $ ruby -v ruby 1.8.6 (2008-03-03 patchlevel 114) [x86_64-linux] $ cat stdin-rewind.rb $stdin.rewind system('echo -n "1: head: "; head -n 1') $stdin.rewind print "2: stdin.gets: ", $stdin.gets pid = Process.fork unless pid $stdin.rewind print "3: stdin.gets: ", $stdin.gets exit end Process.waitpid(pid) $stdin.rewind system('echo -n "4: head: "; head -n 1') $stdin.rewind system('echo -n "5: cat: "; cat') $stdin.rewind print "6: stdin.gets: ", $stdin.gets $ ruby stdin-rewind.rb