From 3cbf88d8d421ff9345466f6c7352e5b7b3940079 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 22 May 2012 12:35:18 +0000 Subject: 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 --- test/net/ftp/test_ftp.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'test/net') diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index 43cee14ac5..f25e10747b 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 -- cgit v1.2.3