From: Steve Tuckner Date: 2002-12-12T10:50:42+09:00 Subject: Open3 and expect This is a multi-part message in MIME format. ------=_NextPart_000_0042_01C2A138.CD879310 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I am trying to duplicate some shell functionality using open3 and am having problems with that. As a way to illustrate this problem, I wrote a small script that uses open3 with expect. Expect uses select to determine when when there is data from stdout. Unfortunately it never is able to log in, because it never gets past the select. Can someone tell me why? I am running this on Red Hat 8.0. require "open3" require "expect" stdin, stdout, stderr = Open3.popen3("ftp ftp.ruby-lang.org ") $expect_verbose = true stdin.expect(": ") do stdout.print "anonymous" stdout.flush end Thanks in advance, Steve Tuckner ------=_NextPart_000_0042_01C2A138.CD879310 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I am = trying to=20 duplicate some shell functionality using open3 and am having problems = with that.=20 As a way to illustrate this problem, I wrote a small script that uses = open3 with=20 expect.  Expect uses select to determine when when there is data = from=20 stdout. Unfortunately it never is able to log in, because it never = gets=20 past the select. Can someone tell me why? I am running this on Red Hat=20 8.0.
 
require=20 "open3"
require "expect"
 
stdin, stdout,=20 stderr =3D Open3.popen3("ftp ftp.ruby-lang.org")
 
$expect_verbose =3D=20 true
 
stdin.expect(": ")=20 do
  stdout.print "anonymous"
 =20 stdout.flush
end
 
Thanks in=20 advance,
 
Steve = Tuckner
------=_NextPart_000_0042_01C2A138.CD879310--