diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d963aa39452..b03e7b191432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Compatibility: * Implemented `Dir#each_child`. * Implemented `Kernel.{chomp, chop}` and `Kernel#{chomp, chop}`. * Implemented `-p` and `-a`, and `-l` CLI options. +* Convert the argument to `File.realpath` with `#to_path` (#1894). Changes: diff --git a/src/main/ruby/truffleruby/core/file.rb b/src/main/ruby/truffleruby/core/file.rb index a8c763303336..1baad1084895 100644 --- a/src/main/ruby/truffleruby/core/file.rb +++ b/src/main/ruby/truffleruby/core/file.rb @@ -934,6 +934,8 @@ def self.readlink(path) end def self.realpath(path, basedir = nil) + path = Truffle::Type.coerce_to_path(path) + unless absolute_path?(path) path = expand_path(path, basedir) end