Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Dir.chdir and native functions #5743
jruby 184.108.40.206-SNAPSHOT (2.5.3) 2019-05-18 d79edcd Java HotSpot(TM) 64-Bit Server VM 11.0.2+9-LTS on 11.0.2+9-LTS +jit [linux-x86_64]
link with sass/sassc-ruby#119
here's a pseudo code to describe the issue
on jruby, the current directory remains unchanged, Dir.chdir has no effect
It probably won't be easy to fix, see #5145 and others
This is intentional; Dir.chdir is not thread-safe at the native level, and since JRuby is often hosted alongside other applications on the JVM, it would not be appropriate for us to start changing the process's current directory.
However... I recognize that the majority of JRuby users these days run a single JRuby in a single JVM, in which case Dir.chdir could possibly do the real native call and change the process's current directory, even though this is still poorly specified across threads.
We also have a mechanism to detect when JRuby is the "main" for this JVM, in which case making chdir do the native behavior might be fine.