Skip to content

Commit e645fbb

Browse files
committed
Fixed missing StringIO exception in download! [Toby Bryans, Delano Mandelbaum]
1 parent 64b5b60 commit e645fbb

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.rdoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
=== 2.0.5 / 19 Aug 2010
3+
4+
* Fixed missing StringIO exception in download! [Toby Bryans, Delano Mandelbaum]
5+
6+
17
=== 2.0.4 / 23 Nov 2009
28

39
* Fixed frozen string issue in StatusException.message [appoxy]

lib/net/sftp/session.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def download(remote, local, options={}, &block)
120120
# and returns the result as a string; otherwise, returns the
121121
# Net::SFTP::Operations::Download instance.
122122
def download!(remote, local=nil, options={}, &block)
123+
require 'stringio' unless defined?(StringIO)
123124
destination = local || StringIO.new
124125
result = download(remote, destination, options, &block).wait
125126
local ? result : destination.string

test/common.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'test/unit'
22
require 'mocha'
3+
require 'stringio'
34

45
begin
56
require 'net/ssh'

test/test_download.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def prepare_large_file_download(local, remote, text)
141141
channel.sends_packet(FXP_CLOSE, :long, 12, :string, "handle")
142142
channel.gets_packet(FXP_STATUS, :long, 12, :long, 0)
143143
end
144-
144+
145145
file = StringIO.new
146146
File.stubs(:open).with(local, "wb").returns(file)
147147

0 commit comments

Comments
 (0)