Compare commits

...

2 commits

2 changed files with 9 additions and 2 deletions

View file

@ -947,6 +947,7 @@ const Node = union(enum) {
while (rest.len > 0) { while (rest.len > 0) {
if (std.mem.indexOfScalar(u8, rest, '\n')) |eol| { if (std.mem.indexOfScalar(u8, rest, '\n')) |eol| {
chunk = rest[0..eol]; chunk = rest[0..eol];
chunk = if (chunk.len > 0 and chunk[chunk.len - 1] == '\r') chunk[0 .. chunk.len - 1] else chunk;
rest = rest[eol + 1 ..]; rest = rest[eol + 1 ..];
need_eol = true; need_eol = true;
} else { } else {

View file

@ -103,7 +103,10 @@ pub fn log_handler(context: usize, parent: tp.pid_ref, arg0: []const u8, output:
const logger = log.logger(@typeName(Self)); const logger = log.logger(@typeName(Self));
defer logger.deinit(); defer logger.deinit();
var it = std.mem.splitScalar(u8, output, '\n'); var it = std.mem.splitScalar(u8, output, '\n');
while (it.next()) |line| if (line.len > 0) logger.print("{s}", .{line}); while (it.next()) |line_| if (line_.len > 0) {
const line = if (line_[line_.len - 1] == '\r') line_[0 .. line_.len - 1] else line_;
logger.print("{s}", .{line});
};
} }
pub fn log_err_handler(context: usize, parent: tp.pid_ref, arg0: []const u8, output: []const u8) void { pub fn log_err_handler(context: usize, parent: tp.pid_ref, arg0: []const u8, output: []const u8) void {
@ -112,7 +115,10 @@ pub fn log_err_handler(context: usize, parent: tp.pid_ref, arg0: []const u8, out
const logger = log.logger(@typeName(Self)); const logger = log.logger(@typeName(Self));
defer logger.deinit(); defer logger.deinit();
var it = std.mem.splitScalar(u8, output, '\n'); var it = std.mem.splitScalar(u8, output, '\n');
while (it.next()) |line| logger.print_err(arg0, "{s}", .{line}); while (it.next()) |line_| if (line_.len > 0) {
const line = if (line_[line_.len - 1] == '\r') line_[0 .. line_.len - 1] else line_;
logger.print_err(arg0, "{s}", .{line});
};
} }
pub fn log_exit_handler(context: usize, parent: tp.pid_ref, arg0: []const u8, err_msg: []const u8, exit_code: i64) void { pub fn log_exit_handler(context: usize, parent: tp.pid_ref, arg0: []const u8, err_msg: []const u8, exit_code: i64) void {