@@ -1938,11 +1938,11 @@ def _redirect_output(self, statement: Statement) -> Tuple[bool, RedirectionSaved
19381938 creationflags = creationflags ,
19391939 start_new_session = start_new_session )
19401940
1941- saved_state = RedirectionSavedState (redirecting = True , self_stdout = self .stdout ,
1941+ saved_state = RedirectionSavedState (redirecting = True , self_stdout = self .stdout , sys_stdout = sys . stdout ,
19421942 piping = True , pipe_proc_reader = self .pipe_proc_reader )
19431943
19441944 self .pipe_proc_reader = utils .ProcReader (proc , self .stdout , sys .stderr )
1945- self .stdout = pipe_write
1945+ sys . stdout = self .stdout = pipe_write
19461946 except Exception as ex :
19471947 self .perror ('Failed to open pipe because - {}' .format (ex ), traceback_war = False )
19481948 pipe_read .close ()
@@ -1965,8 +1965,8 @@ def _redirect_output(self, statement: Statement) -> Tuple[bool, RedirectionSaved
19651965 mode = 'a'
19661966 try :
19671967 new_stdout = open (statement .output_to , mode )
1968- saved_state = RedirectionSavedState (redirecting = True ,
1969- self_stdout = self . stdout , sys_stdout = sys .stdout )
1968+ saved_state = RedirectionSavedState (redirecting = True , self_stdout = self . stdout ,
1969+ sys_stdout = sys .stdout )
19701970 sys .stdout = self .stdout = new_stdout
19711971 except OSError as ex :
19721972 self .perror ('Failed to redirect because - {}' .format (ex ), traceback_war = False )
0 commit comments