Skip to content

Commit 02122ad

Browse files
committed
Remove the extra IO#dup method
1 parent d40fa59 commit 02122ad

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

spec/tags/truffle/methods_tags.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ fails:Public methods on Hash should not include sort
2323
fails:Public methods on IO should include fdatasync
2424
fails:Public methods on IO should include pread
2525
fails:Public methods on IO should include pwrite
26-
fails:Public methods on IO should not include dup
2726
fails:Public methods on IO should not include encode_with
2827
fails:Public methods on IO should not include nonblock
2928
fails:Public methods on IO should not include nonblock=

src/main/ruby/truffleruby/core/io.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,12 @@ def initialize(fd, mode=nil, options=undefined)
11931193
##
11941194
# Obtains a new duplicate descriptor for the current one.
11951195
def initialize_copy(original) # :nodoc:
1196+
fd = original.fileno
1197+
11961198
# The 3rd argument is minimum acceptable descriptor value for the new FD.
11971199
# We want to ensure newly allocated FDs never take the standard IO ones, even
11981200
# if a STDIO stream is closed.
1199-
@descriptor = Truffle::POSIX.fcntl(@descriptor, F_DUPFD_CLOEXEC, 3)
1201+
@descriptor = Truffle::POSIX.fcntl(fd, F_DUPFD_CLOEXEC, 3)
12001202
end
12011203

12021204
def advise(advice, offset = 0, len = 0)
@@ -1324,11 +1326,6 @@ def closed?
13241326
@descriptor == -1
13251327
end
13261328

1327-
def dup
1328-
ensure_open
1329-
super
1330-
end
1331-
13321329
# Argument matrix for IO#gets and IO#each:
13331330
#
13341331
# separator / limit | nil | >= 0 | < 0

0 commit comments

Comments
 (0)