File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Sources/Basics/Concurrency Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -517,7 +517,8 @@ package final class AsyncProcess {
517517
518518 group. enter ( )
519519 stdoutPipe. fileHandleForReading. readabilityHandler = { ( fh: FileHandle ) in
520- let data = ( try ? fh. read ( upToCount: Int . max) ) ?? Data ( )
520+ // 4096 is default pipe buffer size so reading in that size seems most efficient and still get output as it available
521+ let data = ( try ? fh. read ( upToCount: 4096 ) ) ?? Data ( )
521522 if data. count == 0 {
522523 stdoutPipe. fileHandleForReading. readabilityHandler = nil
523524 group. leave ( )
@@ -532,7 +533,8 @@ package final class AsyncProcess {
532533
533534 group. enter ( )
534535 stderrPipe. fileHandleForReading. readabilityHandler = { ( fh: FileHandle ) in
535- let data = ( try ? fh. read ( upToCount: Int . max) ) ?? Data ( )
536+ // 4096 is default pipe buffer size so reading in that size seems most efficient and still get output as it available
537+ let data = ( try ? fh. read ( upToCount: 4096 ) ) ?? Data ( )
536538 if data. count == 0 {
537539 stderrPipe. fileHandleForReading. readabilityHandler = nil
538540 group. leave ( )
You can’t perform that action at this time.
0 commit comments