truffleruby icon indicating copy to clipboard operation
truffleruby copied to clipboard

`Context.currentWorkingDirectory()` does not work to set working directory for script

Open sschuberth opened this issue 7 months ago • 1 comments

Background: This Slack conversation.

In the process of migrating from JRuby to TruffleRuby for runnign a script that's embeddef as a Java resource, I realized that calling Context.currentWorkingDirectory() does not work to change the working directory for the evaluated script. This is the code area of interest.

In JRuby, I used setCurrentDirect() on the ScriptingContainer. With TruffleRuby, I'm using currentWorkingDirectory() on the Context. But that does not work as the script fails with PolyglotException: Could not locate Gemfile.

As @eregon mentioned, this seems to be because TruffleRuby does not adhere to Context.currentWorkingDirectory() correctly and "the working directory is (currently) the native one in TruffleRuby".

sschuberth avatar Apr 23 '25 10:04 sschuberth

Thank you for the report, we'll look into it.

andrykonchin avatar Apr 23 '25 12:04 andrykonchin

Any update here @andrykonchin?

sschuberth avatar Oct 02 '25 19:10 sschuberth

AFAIK the issue isn't fixed yet.

andrykonchin avatar Oct 07 '25 17:10 andrykonchin

Well, that's what I expected as the issue isn't closed. But I was referring to your "we'll look into it", whether that already happened, and work has been started yet.

sschuberth avatar Oct 07 '25 18:10 sschuberth