Title: [652] trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java: Fix reopening of streams instead
Revision
652
Author
olabini
Date
2007-06-22 10:19:17 -0400 (Fri, 22 Jun 2007)

Log Message

Fix reopening of streams instead

Modified Paths


Diff

Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java (651 => 652)


--- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java	2007-06-22 13:43:36 UTC (rev 651)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java	2007-06-22 14:19:17 UTC (rev 652)
@@ -75,10 +75,18 @@
 		RubyIO stdin = new RubyIO(runtime, request.getInputStream());
 		RubyIO stdout = new RubyIO(runtime, new HttpOutput(response));
 
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdin", stdin));
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdout", stdout));
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$>", stdout));
-        runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$defout", stdout));
+        IRubyObject v1 = runtime.getGlobalVariables().get("$stdin");
+        if(v1 instanceof RubyIO) {
+            ((RubyIO)v1).reopen(new IRubyObject[]{stdin});
+        } else {
+            runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdin", stdin));
+        }
+        v1 = runtime.getGlobalVariables().get("$stdout");
+        if(v1 instanceof RubyIO) {
+            ((RubyIO)v1).reopen(new IRubyObject[]{stdout});
+        } else {
+            runtime.defineVariable(new org.jruby.runtime.GlobalVariable(runtime, "$stdout", stdout));
+        }
 
 		// setup the environment
 		setupEnvironment(runtime, request);
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to