1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Rescue exception from writing to a socket.

conn.print may raise EPIPE because ftp.retrbinary closes the connection
because of read_timeout. but the exact result varies from the situation
like platform, timing, and so on.
it may raise ECONNRESET, ECONNABORTED, EOFError, or nothing raised.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-05-21 08:48:32 +00:00
parent e7ce771354
commit acb10b8c32

View file

@ -392,7 +392,7 @@ class FTPTest < Test::Unit::TestCase
sleep(0.1)
conn.print(binary_data[0,1024])
sleep(0.5)
assert_raise(Errno::EPIPE){ conn.print(binary_data[1024, 1024]) }
conn.print(binary_data[1024, 1024]) rescue nil # may raise EPIPE or something
conn.close
sock.print("226 Transfer complete.\r\n")
}