Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sschuberth opened this issue Apr 23, 2025 · 1 comment
Labels
embedding Uses TruffleRuby embedded, i.e., started from Java (so not the standalone)

Comments

@sschuberth
Copy link

sschuberth commented Apr 23, 2025

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".

@andrykonchin
Copy link
Member

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

@eregon eregon added embedding Uses TruffleRuby embedded, i.e., started from Java (so not the standalone) and removed polyglot Uses multiple Truffle languages or host interop labels May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedding Uses TruffleRuby embedded, i.e., started from Java (so not the standalone)
Projects
None yet
Development

No branches or pull requests

3 participants