Skip to content
Permalink
Browse files
Peel off options hash passed to Open3.popen3.
Fixes #1290.
Fixes #1547.
  • Loading branch information
headius committed Dec 2, 2014
1 parent 0167f3f commit 66b29052ff77a86fb8d7d95c461191f6bf6aecc3
Showing with 7 additions and 0 deletions.
  1. +7 −0 core/src/main/java/org/jruby/util/ShellLauncher.java
@@ -732,6 +732,13 @@ private static Process popenShared(Ruby runtime, IRubyObject[] strings, Map env,
File pwd = new File(runtime.getCurrentDirectory());

try {
// Peel off env hash, if given
IRubyObject envHash = null;
if (env == null && strings.length > 0 && !(envHash = TypeConverter.checkHashType(runtime, strings[0])).isNil()) {
strings = Arrays.copyOfRange(strings, 1, strings.length);
env = (Map)envHash;
}

String[] args = parseCommandLine(runtime.getCurrentContext(), runtime, strings);
boolean useShell = false;
if (addShell) for (String arg : args) useShell |= shouldUseShell(arg);

0 comments on commit 66b2905

Please sign in to comment.