Cloned IO objects can be closed independently
---------------------------------------------
Key: JRUBY-1891
URL: http://jira.codehaus.org/browse/JRUBY-1891
Project: JRuby
Issue Type: Sub-task
Reporter: Charles Oliver Nutter
Assignee: Thomas E Enebo
Fix For: JRuby 1.1
Error, caused by both IO objects sharing an IOHandler that gets closed:
{noformat}
1) Error:
test_clone(TestIO):
Errno::EBADF: Bad file descriptor
test/rubicon/test_io.rb:345:in `run'
{noformat}
Test:
{code}
def test_clone
# check file position shared
file = File.open(@file, "r")
io = []
io[0] = IO.new(file.fileno, "r")
begin
io[1] = io[0].clone
begin
count = 0
io[count & 1].each do |line|
num = line[0..1].to_i
assert_equal(count, num)
count += 1
end
assert_equal(10, count)
ensure
io[1].close
end
ensure
io[0].close
end
assert_raise(Errno::EBADF) { file.close }
end
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email