Skip to content

Commit

Permalink
[Truffle] Add posix dup for IO#dup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed May 13, 2015
1 parent 5376cb4 commit 8f62197
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/io/dup_tags.txt
@@ -1,5 +1,3 @@
fails:IO#dup returns a new IO instance
fails:IO#dup sets a new descriptor on the returned object
fails:IO#dup allows closing the new IO without affecting the original
fails:IO#dup allows closing the original IO without affecting the new one
fails:IO#dup raises IOError on closed stream
Expand Up @@ -72,6 +72,20 @@ public int chown(RubyString path, int owner, int group) {

}

@CoreMethod(names = "dup", isModuleFunction = true, required = 1)
public abstract static class DupNode extends CoreMethodArrayArgumentsNode {

public DupNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization
public int dup(int descriptor) {
return posix().dup(descriptor);
}

}

@CoreMethod(names = "fchmod", isModuleFunction = true, required = 2)
public abstract static class FchmodNode extends CoreMethodArrayArgumentsNode {

Expand Down

0 comments on commit 8f62197

Please sign in to comment.