Open3 and expect

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
ftp://ftp.ruby-lang.org ")

$expect_verbose = true

stdin.expect(": ") do
stdout.print "anonymous"
stdout.flush
end

Thanks in advance,

Steve Tuckner

Hi,

···

At Thu, 12 Dec 2002 10:50:42 +0900, Steve Tuckner wrote:

stdin, stdout, stderr = Open3.popen3("ftp ftp.ruby-lang.org
ftp://ftp.ruby-lang.org ")

Is this in a line?

$ sh -c 'ftp ftp.ruby-lang.org ftp://ftp.ruby-lang.org
sh: -c: line 1: syntax error near unexpected token newline' sh: -c: line 1: ftp ftp.ruby-lang.org ftp://ftp.ruby-lang.org


Nobu Nakada

I think the ftp://ftp.ruby-lang.org got inserted by my HTML mail stuff. the
line is only:

stdin, stdout, stderr = Open3.popen3(“ftp ftp.ruby-lang.org”)

···

-----Original Message-----
From: nobu.nokada@softhome.net [mailto:nobu.nokada@softhome.net]
Sent: Wednesday, December 11, 2002 8:29 PM
To: ruby-talk ML
Subject: Re: Open3 and expect

Hi,

At Thu, 12 Dec 2002 10:50:42 +0900, > Steve Tuckner wrote:

stdin, stdout, stderr = Open3.popen3("ftp ftp.ruby-lang.org
ftp://ftp.ruby-lang.org ")

Is this in a line?

$ sh -c 'ftp ftp.ruby-lang.org ftp://ftp.ruby-lang.org
sh: -c: line 1: syntax error near unexpected token newline' sh: -c: line 1: ftp ftp.ruby-lang.org ftp://ftp.ruby-lang.org


Nobu Nakada