summaryrefslogtreecommitdiff
path: root/test/net/ftp
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-22 12:35:18 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-22 12:35:18 +0000
commit3cbf88d8d421ff9345466f6c7352e5b7b3940079 (patch)
treeead1a0eb88028e6af271510156532c1833f55cde /test/net/ftp
parent8bcf7fc40266faa09cf8b6cebb2d96c1bb8d51ee (diff)
rescue EPIPE raised from conn.print because of client's timeout
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/ftp')
-rw-r--r--test/net/ftp/test_ftp.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index 43cee14..f25e107 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -327,19 +327,21 @@ class FTPTest < Test::Unit::TestCase
sock.print("200 PORT command successful.\r\n")
commands.push(sock.gets)
sock.print("150 Here comes the directory listing.\r\n")
- conn = TCPSocket.new(host, port)
- list_lines.each_with_index do |l, i|
- if i == 1
- sleep(0.5)
- else
- sleep(0.1)
+ begin
+ conn = TCPSocket.new(host, port)
+ list_lines.each_with_index do |l, i|
+ if i == 1
+ sleep(0.5)
+ else
+ sleep(0.1)
+ end
+ conn.print(l, "\r\n")
end
- conn.print(l, "\r\n")
+ rescue Errno::EPIPE
+ ensure
+ assert_nil($!)
+ conn.close
end
- conn.shutdown(Socket::SHUT_WR)
- conn.read_timeout = 1
- conn.read unless conn.eof?
- conn.close
sock.print("226 Directory send OK.\r\n")
}
begin