diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-21 02:27:07 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-21 02:27:07 +0000 |
commit | 52f0c6780e5abd58a68befdbf14a6a065161bf8d (patch) | |
tree | 52a2a694c6a15767bb4cd783121af07405b86f7c /test/net/ftp/test_ftp.rb | |
parent | d795f2d1a803c03a7180f6f5049d3a9a0e8849f0 (diff) | |
download | ruby-52f0c6780e5abd58a68befdbf14a6a065161bf8d.tar.gz |
* lib/net/ftp.rb (Net::FTP#transfercmd): rescue shutdown.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/ftp/test_ftp.rb')
-rw-r--r-- | test/net/ftp/test_ftp.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index 5a566a52f2..a3a08c67b2 100644 --- a/test/net/ftp/test_ftp.rb +++ b/test/net/ftp/test_ftp.rb @@ -6,6 +6,16 @@ require "stringio" class FTPTest < Test::Unit::TestCase SERVER_ADDR = "127.0.0.1" + def setup + @thread = nil + end + + def teardown + if @thread + @thread.join + end + end + def test_not_connected ftp = Net::FTP.new assert_raise(Net::FTPConnectionError) do @@ -272,7 +282,8 @@ class FTPTest < Test::Unit::TestCase conn.print(l, "\r\n") end conn.shutdown(Socket::SHUT_WR) - conn.read + conn.read_timeout = 1 + conn.read unless conn.eof? conn.close sock.print("226 Directory send OK.\r\n") } @@ -586,7 +597,7 @@ class FTPTest < Test::Unit::TestCase def create_ftp_server(sleep_time = nil) server = TCPServer.new(SERVER_ADDR, 0) - Thread.start do + @thread = Thread.start do begin if sleep_time sleep(sleep_time) |