File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1681,15 +1681,24 @@ def get_file_results(self):
1681
1681
'row' : self .line_offset + line_number , 'col' : offset + 1 ,
1682
1682
'code' : code , 'text' : text ,
1683
1683
})
1684
+ # stdout is block buffered when not stdout.isatty().
1685
+ # When using pep8 in multiprocess, line can be broken where
1686
+ # buffer boundary since other processes write to same file.
1687
+ # So flush() after print() to avoid buffer boundary.
1688
+ # Typical buffer size is 8192. line written safely when
1689
+ # len(line) < 8192.
1690
+ sys .stdout .flush ()
1684
1691
if self ._show_source :
1685
1692
if line_number > len (self .lines ):
1686
1693
line = ''
1687
1694
else :
1688
1695
line = self .lines [line_number - 1 ]
1689
1696
print (line .rstrip ())
1690
1697
print (re .sub (r'\S' , ' ' , line [:offset ]) + '^' )
1698
+ sys .stdout .flush ()
1691
1699
if self ._show_pep8 and doc :
1692
1700
print (' ' + doc .strip ())
1701
+ sys .stdout .flush ()
1693
1702
return self .file_errors
1694
1703
1695
1704
You can’t perform that action at this time.
0 commit comments