Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f7d09d01f405
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ca2f5f765060
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Apr 27, 2015

  1. Copy the full SHA
    c0a2b33 View commit details

Commits on Apr 28, 2015

  1. Copy the full SHA
    b91a581 View commit details
  2. Copy the full SHA
    ca2f5f7 View commit details
Showing with 17 additions and 10 deletions.
  1. +1 −1 core/pom.xml
  2. +1 −1 core/src/main/java/org/jruby/Ruby.java
  3. +9 −6 core/src/main/java/org/jruby/RubyIO.java
  4. +6 −2 core/src/main/java/org/jruby/util/ShellLauncher.java
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.0.10</version>
<version>3.0.11</version>
<type>jar</type>
</dependency>
<dependency>
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1261,7 +1261,7 @@ private void init() {
// attempt to enable unlimited-strength crypto on OpenJDK
try {
Class jceSecurity = Class.forName("javax.crypto.JceSecurity");
Field isRestricted = jceSecurity.getField("isRestricted");
Field isRestricted = jceSecurity.getDeclaredField("isRestricted");
isRestricted.setAccessible(true);
isRestricted.set(null, false);
isRestricted.setAccessible(false);
15 changes: 9 additions & 6 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -4135,7 +4135,7 @@ public static IRubyObject popen(ThreadContext context, IRubyObject recv, IRubyOb
ioOptions = newIOOptions(runtime, args[firstArg + 1].convertToString().toString());
}

ShellLauncher.POpenProcess process = ShellLauncher.popen(runtime, new IRubyObject[]{cmdObj}, (RubyHash)envHash, ioOptions.getModeFlags());
ShellLauncher.POpenProcess process = ShellLauncher.popen(runtime, cmdObj, (RubyHash)envHash, ioOptions.getModeFlags());

// Yes, this is gross. java.lang.Process does not appear to be guaranteed
// "ready" when we get it back from Runtime#exec, so we try to give it a
@@ -4240,7 +4240,8 @@ public Ruby19POpen(Ruby runtime, IRubyObject[] args) {
if ((arg0 = TypeConverter.checkStringType(runtime, args[firstArg])).isNil()) {
throw runtime.newTypeError(args[firstArg], runtime.getString());
}
_cmdPlusArgs = new IRubyObject[]{arg0};
_cmdPlusArgs = null;
_cmd = arg0;
} else {
RubyArray arg0Ary = (RubyArray) arg0;
if (arg0Ary.isEmpty()) throw runtime.newArgumentError("wrong number of arguments");
@@ -4254,15 +4255,17 @@ public Ruby19POpen(Ruby runtime, IRubyObject[] args) {
_env = arg0Ary.eltOk(arg0Ary.size() - 1);
}
_cmdPlusArgs = arg0Ary.toJavaArray();
_cmd = _cmdPlusArgs[0];
}

if (Platform.IS_WINDOWS) {
String commandString = _cmdPlusArgs[0].convertToString().toString().replace('/', '\\');
_cmdPlusArgs[0] = runtime.newString(commandString);
String commandString = _cmd.convertToString().toString().replace('/', '\\');
_cmd = runtime.newString(commandString);
if (_cmdPlusArgs != null) _cmdPlusArgs[0] = _cmd;
} else {
_cmdPlusArgs[0] = _cmdPlusArgs[0].convertToString();
_cmd = _cmd.convertToString();
if (_cmdPlusArgs != null) _cmdPlusArgs[0] = _cmd;
}
_cmd = _cmdPlusArgs[0];

this.cmd = (RubyString)_cmd;
this.cmdPlusArgs = _cmdPlusArgs;
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/util/ShellLauncher.java
Original file line number Diff line number Diff line change
@@ -689,7 +689,7 @@ public static long reflectPidFromProcess(Process process) {
}

public static Process run(Ruby runtime, IRubyObject string) throws IOException {
return run(runtime, new IRubyObject[] {string}, false);
return run(runtime, new IRubyObject[]{string}, false);
}

public static POpenProcess popen(Ruby runtime, IRubyObject string, ModeFlags modes) throws IOException {
@@ -699,6 +699,10 @@ public static POpenProcess popen(Ruby runtime, IRubyObject string, ModeFlags mod
public static POpenProcess popen(Ruby runtime, IRubyObject[] strings, Map env, ModeFlags modes) throws IOException {
return new POpenProcess(popenShared(runtime, strings, env), runtime, modes);
}

public static POpenProcess popen(Ruby runtime, IRubyObject string, Map env, ModeFlags modes) throws IOException {
return new POpenProcess(popenShared(runtime, new IRubyObject[] {string}, env, true), runtime, modes);
}

@Deprecated
public static POpenProcess popen(Ruby runtime, IRubyObject string, IOOptions modes) throws IOException {
@@ -723,7 +727,7 @@ private static Process popenShared(Ruby runtime, IRubyObject[] strings) throws I
}

private static Process popenShared(Ruby runtime, IRubyObject[] strings, Map env) throws IOException {
return popenShared(runtime, strings, env, true);
return popenShared(runtime, strings, env, false);
}

private static Process popenShared(Ruby runtime, IRubyObject[] strings, Map env, boolean addShell) throws IOException {