--- expect-5.43/example/unbuffer.orig 2004-01-25 10:37:49.000000000 +0900 +++ expect-5.43/example/unbuffer 2005-05-31 10:37:19.000000000 +0900 @@ -6,10 +6,17 @@ # pipeline set stty_init "-echo" eval spawn -noecho [lrange $argv 1 end] - interact + close_on_eof -i $user_spawn_id 0 + interact { + eof { + # flush remaining output from child + expect -timeout 1 -re .+ + return + } + } } else { set stty_init "-opost" - eval spawn -noecho $argv set timeout -1 + eval spawn -noecho $argv expect }