diff options
Diffstat (limited to 'ext/pty/expect_sample.rb')
-rw-r--r-- | ext/pty/expect_sample.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/ext/pty/expect_sample.rb b/ext/pty/expect_sample.rb index 10c50ead7a..2a2e29f866 100644 --- a/ext/pty/expect_sample.rb +++ b/ext/pty/expect_sample.rb @@ -15,10 +15,6 @@ PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid| $expect_verbose = false - r_f.expect(/^Name.*: /) do - w_f.print "ftp\n" - end - if !ENV['USER'].nil? username = ENV['USER'] elsif !ENV['LOGNAME'].nil? @@ -27,11 +23,8 @@ PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid| username = 'guest' end - r_f.expect('word:') do - w_f.print username+"@\n" - end - r_f.expect("> ") do - w_f.print "cd pub/ruby\n" + r_f.expect(/^(Name).*: |(word):|> /) do + w_f.puts($1 ? "ftp" : $2 ? "#{username}@" : "cd pub/ruby") end r_f.expect("> ") do w_f.print "dir\n" |