Skip to content

Commit

Permalink
Fix JRUBY-6603
Browse files Browse the repository at this point in the history
To avoid attempting to read the ENV hash while it might be updated
elsewhere, I added a dup call. This is not 100% perfect if dup is
not threadsafe (unsure) but it was able to pass the given
contrived example.
  • Loading branch information
headius committed May 16, 2012
1 parent 8fecee7 commit 5032ade
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/jruby/util/ShellLauncher.java
Expand Up @@ -215,7 +215,7 @@ private static String[] getCurrentEnv(Ruby runtime) {
}

private static String[] getCurrentEnv(Ruby runtime, Map mergeEnv) {
RubyHash hash = (RubyHash)runtime.getObject().getConstant("ENV");
RubyHash hash = (RubyHash)runtime.getObject().getConstant("ENV").dup();
String[] ret;

if (mergeEnv != null && !mergeEnv.isEmpty()) {
Expand Down

0 comments on commit 5032ade

Please sign in to comment.