Skip to content

Commit e371995

Browse files
committed
[Truffle] Add File.symlink POSIX node.
1 parent 46f43bb commit e371995

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
fails:File.symlink creates a symlink between a source and target file
2-
fails:File.symlink creates a symbolic link
3-
fails:File.symlink accepts args that have #to_path methods
42
fails:File.symlink raises an Errno::EEXIST if the target already exists
5-
fails:File.symlink? returns true if the file is a link
6-
fails:File.symlink? accepts an object that has a #to_path method

truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PosixNodes.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,4 +318,22 @@ public int isATTY(int fd) {
318318

319319
}
320320

321+
@CoreMethod(names = "symlink", isModuleFunction = true, required = 2)
322+
public abstract static class SymlinkNode extends CoreMethodNode {
323+
324+
public SymlinkNode(RubyContext context, SourceSection sourceSection) {
325+
super(context, sourceSection);
326+
}
327+
328+
public SymlinkNode(SymlinkNode prev) {
329+
super(prev);
330+
}
331+
332+
@Specialization
333+
public int symlink(RubyString first, RubyString second) {
334+
return posix().symlink(first.toString(), second.toString());
335+
}
336+
337+
}
338+
321339
}

0 commit comments

Comments
 (0)