20094 16 ()  9:59, Jun Young Kim <jykim / altibase.com> :
> yes, ftp client is waiting some letters for log-in.
>
> but, before that, client program print out "hello message" like
>
> --------------------------------------------------
> Connected to ftp.gnu.org.
> 220 GNU FTP server ready.
> Name (ftp.gnu.org:junyoung):
> --------------------------------------------------
>
> under a hanging situation, I cannot also see this message.
>
> anyway.
> (a) I tried to get 1byte by sysread. it's not different.
> (b) Is interactive tty different from stdin, stdout?
> I believe although ftp is using tty, it should print out something in
> stdout.
>
Try this:
require 'open3'
include Open3

stdin, stdout, stderr = popen3("ftp -inv ftp.gnu.org")
while line=stdout.gets
        print line
end

I guess ftp is trying to interact with tty.
Using pty and expect is more suitable in this case

require 'pty'
require 'expect'

PTY.spawn('ftp ftp.gnu.org') do |r,w,cid|
  r.expect /Name.*:\s+/ do |line|
    print line
    w.puts "anonymous"
  end
  while line=r.gets
    print line
  end
end


Regards,

Park Heesob