File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -704,12 +704,15 @@ def pipe_objs(out):
704
704
out .write (s .encode ('utf-8' ))
705
705
out .close ()
706
706
Thread (target = pipe_objs , args = [pipe .stdin ]).start ()
707
- result = (x .rstrip (b'\n ' ).decode ('utf-8' ) for x in iter (pipe .stdout .readline , b'' ))
708
- pipe .wait ()
709
- if pipe .returncode :
710
- raise Exception ("Pipe function `%s' exited "
711
- "with error code %d" % (command , pipe .returncode ))
712
- return result
707
+ def check_return_code ():
708
+ pipe .wait ()
709
+ if pipe .returncode :
710
+ raise Exception ("Pipe function `%s' exited "
711
+ "with error code %d" % (command , pipe .returncode ))
712
+ else :
713
+ return None
714
+ return (x .rstrip (b'\n ' ).decode ('utf-8' ) for x in
715
+ chain (iter (pipe .stdout .readline , b'' ), iter (check_return_code , None )))
713
716
return self .mapPartitions (func )
714
717
715
718
def foreach (self , f ):
You can’t perform that action at this time.
0 commit comments