File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -826,6 +826,29 @@ def recv_thread():
826
826
while t .is_alive ():
827
827
t .join (timeout = 0.1 )
828
828
829
+ def stream (self , line_mode = True ):
830
+ """stream()
831
+
832
+ Receive data until the tube exits, and print it to stdout.
833
+
834
+ Similar to :func:`interactive`, except that no input is sent.
835
+
836
+ Similar to ``print tube.recvall()`` except that data is printed
837
+ as it is received, rather than after all data is received.
838
+
839
+ Arguments:
840
+ line_mode(bool): Whether to receive line-by-line or raw data.
841
+ """
842
+ data = True
843
+ while data :
844
+ if line_mode :
845
+ data = self .recvline ()
846
+ else :
847
+ data = self .recv ()
848
+
849
+ if data :
850
+ sys .stdout .write (data )
851
+
829
852
def clean (self , timeout = 0.05 ):
830
853
"""clean(timeout = 0.05)
831
854
You can’t perform that action at this time.
0 commit comments