Skip to content

Instantly share code, notes, and snippets.

@enebo
Created November 8, 2010 21:52
Show Gist options
  • Save enebo/668334 to your computer and use it in GitHub Desktop.
Save enebo/668334 to your computer and use it in GitHub Desktop.
git diff src
git diff src
diff --git a/src/org/jruby/RubyIO.java b/src/org/jruby/RubyIO.java
index e1b77a0..a78152c 100644
--- a/src/org/jruby/RubyIO.java
+++ b/src/org/jruby/RubyIO.java
@@ -3425,16 +3425,10 @@ public class RubyIO extends RubyObject {
IRubyObject cmdObj = null;
if (Platform.IS_WINDOWS) {
String[] tokens = args[0].convertToString().toString().split(" ", 2);
- if (tokens.length > 1) {
- cmdObj = new RubyString(runtime, (RubyClass) recv,
- (tokens[0].replace('/', '\\') + ' ' + tokens[1]));
- }
- else {
- cmdObj = new RubyString(runtime, (RubyClass) recv,
- (tokens[0].replace('/','\\')));
- }
- }
- else {
+ String commandString = tokens[0].replace('/', '\\') +
+ (tokens.length > 1 ? ' ' + tokens[1] : "");
+ cmdObj = runtime.newString(commandString);
+ } else {
cmdObj = args[0].convertToString();
}
runtime.checkSafeString(cmdObj);
@@ -3453,7 +3447,7 @@ public class RubyIO extends RubyObject {
}
ModeFlags modes = new ModeFlags(mode);
-
+
ShellLauncher.POpenProcess process = ShellLauncher.popen(runtime, cmdObj, modes);
// Yes, this is gross. java.lang.Process does not appear to be guaranteed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment