Skip to content

Commit

Permalink
[Truffle] IO#close don't close already closed io
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Fish committed Sep 7, 2016
1 parent 640732c commit e270de2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/close_tags.txt
@@ -1,3 +1,2 @@
slow:ARGF.close does not close STDIN
fails:ARGF.close does not close STDIN
fails:ARGF.close doesn't raise an IOError if called on a closed stream
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/io/close_tags.txt
@@ -1,5 +1,3 @@
fails:IO#close does not raise anything when self was already closed
fails:IO#close does nothing if already closed
slow:IO#close on an IO.popen stream clears #pid
slow:IO#close on an IO.popen stream sets $?
slow:IO#close on an IO.popen stream waits for the child to exit
2 changes: 2 additions & 0 deletions truffle/src/main/ruby/core/io.rb
Expand Up @@ -2672,6 +2672,8 @@ def write_nonblock(data)
end

def close
return nil if closed?

begin
flush
ensure
Expand Down

0 comments on commit e270de2

Please sign in to comment.