mailr10121 - /branches/multi_processor_merge/multi/processor.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 06, 2010 - 19:20:
Author: bugman
Date: Wed Jan  6 19:20:59 2010
New Revision: 10121

URL: http://svn.gna.org/viewcvs/relax?rev=10121&view=rev
Log:
Modified the IO redirection methods in the Processor base class.

The original IO streams are stored and then restored instead of 
sys.__stdout__ and sys.__stderr__.


Modified:
    branches/multi_processor_merge/multi/processor.py

Modified: branches/multi_processor_merge/multi/processor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/multi/processor.py?rev=10121&r1=10120&r2=10121&view=diff
==============================================================================
--- branches/multi_processor_merge/multi/processor.py (original)
+++ branches/multi_processor_merge/multi/processor.py Wed Jan  6 19:20:59 2010
@@ -546,9 +546,15 @@
         @type stdio_capture:    list of two file-like objects
         '''
 
+        # Store the original STDOUT and STDERR for restoring later on.
+        self.orig_stdout = sys.stdout
+        self.orig_stderr = sys.stderr
+
+        # Default to self.stdio_capture if stdio_capture is not supplied.
         if stdio_capture == None:
             stdio_capture = self.stdio_capture
 
+        # IO redirection.
         sys.stdout = self.stdio_capture[0]
         sys.stderr = self.stdio_capture[1]
 
@@ -735,8 +741,9 @@
         @note:  sys.stdout and sys.stderr are replaced with sys.__stdout__ 
ans sys.__stderr__.
         '''
 
-        sys.stdout = sys.__stdout__
-        sys.stderr = sys.__stderr__
+        # Restore the IO streams.
+        sys.stdout = self.orig_stdout
+        sys.stderr = self.orig_stderr
 
 
     def return_object(self, result):




Related Messages


Powered by MHonArc, Updated Thu Jan 07 12:00:02 2010