Permalink
Browse files

Revert "Close subprocess stderr when executing Kernel#system call. El…

…iminates "sad" output from spec runs, as well as stty errors when setting up Radiant."

This reverts commit 14f69b6. Reverted
for 1.3 series only.
  • Loading branch information...
1 parent e76a38a commit 2fd6c3d9018ba3d1e3e80f280d04f94c14351eaa @nicksieger nicksieger committed Jun 15, 2009
Showing with 1 addition and 47 deletions.
  1. +1 −1 src/org/jruby/RubyKernel.java
  2. +0 −46 src/org/jruby/util/ShellLauncher.java
@@ -1357,7 +1357,7 @@ public static RubyBoolean system(ThreadContext context, IRubyObject recv, IRubyO
Ruby runtime = context.getRuntime();
int resultCode;
try {
- resultCode = ShellLauncher.runAndWaitNoError(runtime, args);
+ resultCode = ShellLauncher.runAndWait(runtime, args);
} catch (Exception e) {
resultCode = 127;
}
@@ -192,10 +192,6 @@ public static int runAndWait(Ruby runtime, IRubyObject[] rawArgs) {
return runAndWait(runtime, rawArgs, runtime.getOutputStream());
}
- public static int runAndWaitNoError(Ruby runtime, IRubyObject[] rawArgs) {
- return runAndWaitNoError(runtime, rawArgs, runtime.getOutputStream());
- }
-
public static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs) {
return runWithoutWait(runtime, rawArgs, runtime.getOutputStream());
}
@@ -247,19 +243,6 @@ public static int runAndWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream o
}
}
- public static int runAndWaitNoError(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
- InputStream input = runtime.getInputStream();
- try {
- Process aProcess = run(runtime, rawArgs);
- handleStreams(aProcess,input,output);
- return aProcess.waitFor();
- } catch (IOException e) {
- throw runtime.newIOErrorFromException(e);
- } catch (InterruptedException e) {
- throw runtime.newThreadError("unexpected interrupt");
- }
- }
-
public static long runWithoutWait(Ruby runtime, IRubyObject[] rawArgs, OutputStream output) {
try {
POpenProcess aProcess = new POpenProcess(popenShared(runtime, rawArgs), runtime);
@@ -859,35 +842,6 @@ private static void handleStreams(Process p, InputStream in, OutputStream out, O
try { t3.interrupt(); } catch (SecurityException se) {}
}
- private static void handleStreams(Process p, InputStream in, OutputStream out) throws IOException {
- InputStream pOut = p.getInputStream();
- p.getErrorStream().close();
- OutputStream pIn = p.getOutputStream();
-
- StreamPumper t1 = new StreamPumper(pOut, out, false, Pumper.Slave.IN, p);
-
- // The assumption here is that the 'in' stream provides
- // proper available() support. If available() always
- // returns 0, we'll hang!
- StreamPumper t3 = new StreamPumper(in, pIn, true, Pumper.Slave.OUT, p);
-
- t1.start();
- t3.start();
-
- try { t1.join(); } catch (InterruptedException ie) {}
- t3.quit();
-
- try { out.flush(); } catch (IOException io) {}
-
- try { pIn.close(); } catch (IOException io) {}
- try { pOut.close(); } catch (IOException io) {}
-
- // Force t3 to quit, just in case if it's stuck.
- // Note: On some platforms, even interrupt might not
- // have an effect if the thread is IO blocked.
- try { t3.interrupt(); } catch (SecurityException se) {}
- }
-
private static String[] parseCommandLine(ThreadContext context, Ruby runtime, IRubyObject[] rawArgs) {
String[] args;
if (rawArgs.length == 1) {

0 comments on commit 2fd6c3d

Please sign in to comment.