Skip to content

Commit 0c09944

Browse files
authored
Merge pull request #9117 from katafrakt/fileutils-error-msg
Add file path to error message when unlinking non-existing file
2 parents b11505b + f7c2c4f commit 0c09944

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/java/org/jruby/RubyFile.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,9 +1213,10 @@ public static IRubyObject unlink(ThreadContext context, IRubyObject recv, IRubyO
12131213

12141214
var cwd = context.runtime.getCurrentDirectory();
12151215
for (int i = 0; i < args.length; i++) {
1216-
var toUnlink = JRubyFile.create(cwd, get_path(context, args[i]).toString()).getAbsolutePath();
1216+
var path = get_path(context, args[i]).toString();
1217+
var toUnlink = JRubyFile.create(cwd, path).getAbsolutePath();
12171218

1218-
if (posix.unlink(toUnlink) < 0) throw context.runtime.newErrnoFromInt(posix.errno());
1219+
if (posix.unlink(toUnlink) < 0) throw context.runtime.newErrnoFromInt(posix.errno(), path);
12191220
}
12201221

12211222
return asFixnum(context, args.length);

0 commit comments

Comments
 (0)