Author: bugman Date: Wed Jan 6 19:12:32 2010 New Revision: 10119 URL: http://svn.gna.org/viewcvs/relax?rev=10119&view=rev Log: Bug fix for IO redirection! This may cause problems, but now IO redirection has been fixed. 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=10119&r1=10118&r2=10119&view=diff ============================================================================== --- branches/multi_processor_merge/multi/processor.py (original) +++ branches/multi_processor_merge/multi/processor.py Wed Jan 6 19:12:32 2010 @@ -492,7 +492,9 @@ # output on masters and slaves # processor id the replacement stdio file like objects are stored in the modulevariable # global_stdio_capture - self.setup_stdio_capture(stdio_capture) + + # Edward: This has been commented out as this is where IO redirection goes haywire! + #self.setup_stdio_capture(stdio_capture) def abort(self): @@ -546,9 +548,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 +743,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):