fix: don't log blank lines output by git to stderr

This commit is contained in:
CJ van den Berg 2025-08-04 09:23:52 +02:00
parent 28da270834
commit 5724739b51
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -168,7 +168,8 @@ pub fn status(context_: usize) Error!void {
}.result, struct {
fn result(_: usize, _: tp.pid_ref, output: []const u8) void {
var it = std.mem.splitScalar(u8, output, '\n');
while (it.next()) |line| std.log.err("{s}: {s}", .{ module_name, line });
while (it.next()) |line| if (line.len > 0)
std.log.err("{s}: {s}", .{ module_name, line });
}
}.result, exit_null(tag));
}
@ -183,7 +184,8 @@ fn git_line_output(context_: usize, comptime tag: []const u8, cmd: anytype) Erro
}.result, struct {
fn result(_: usize, _: tp.pid_ref, output: []const u8) void {
var it = std.mem.splitScalar(u8, output, '\n');
while (it.next()) |line| std.log.err("{s}: {s}", .{ module_name, line });
while (it.next()) |line| if (line.len > 0)
std.log.err("{s}: {s}", .{ module_name, line });
}
}.result, exit_null(tag));
}