Skip to content

Commit 9a69e97

Browse files
committed
Complete fix for #106.
1 parent ad13b37 commit 9a69e97

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Classes/Util/PBEasyPipe.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ - (void)setDataOutput:(nonnull NSMutableData *)dataOutput {
3636
NSAssert(fileHandle != nil, @"should have file handle for reading");
3737

3838
fileHandle.readabilityHandler = ^(NSFileHandle * _Nonnull fileHandle) {
39-
[dataOutput appendData:fileHandle.availableData];
40-
[fileHandle closeFile];
39+
NSData *data = fileHandle.availableData;
40+
if (data.length) {
41+
[dataOutput appendData:data];
42+
} else {
43+
[fileHandle closeFile];
44+
}
4145
};
4246
}
4347

0 commit comments

Comments
 (0)