aboutsummaryrefslogtreecommitdiffstats
path: root/ext/pty/expect_sample.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-07 05:56:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-07 05:56:52 +0000
commita37d419c5dfced39d99d26bd4012a9700eb7bda4 (patch)
tree25d778cc3671e628211c51c4f5ee5b568e722732 /ext/pty/expect_sample.rb
parentf800cdbabc950ff4d18f9183c75670cb2a937d84 (diff)
downloadruby-a37d419c5dfced39d99d26bd4012a9700eb7bda4.tar.gz
* ext/pty/pty.c (MasterDevice, SlaveDevice, deviceNo): constified.
* ext/pty/pty.c (SlaveName): removed static buffer. * ext/pty/expect_sample.rb: support for autologin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty/expect_sample.rb')
-rw-r--r--ext/pty/expect_sample.rb11
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"