Skip to content

Commit

Permalink
logging: separate by \r as well as \n and filter empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Apr 29, 2024
1 parent 06b806f commit 1019ed7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/QEMUKitInternal/QEMULogging.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ - (BOOL)redirectStandardFds {
return @[];
}
NSString *string = [*buffer stringByAppendingString:line];
NSArray *lines = [string componentsSeparatedByString:@"\n"];
NSArray *lines = [string componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\r\n"]];
*buffer = [lines lastObject];
if (lines.count > 0) {
lines = [lines subarrayWithRange:NSMakeRange(0, lines.count - 1)];
}

return lines;
}

Expand Down

0 comments on commit 1019ed7

Please sign in to comment.