Fix extraneous blank lines in mcp logs output
Skip empty lines from the scanner that result from double newlines (application slog trailing newline + container runtime newline). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -63,8 +63,12 @@ func (a *Agent) Logs(req *mcpv1.LogsRequest, stream mcpv1.McpAgentService_LogsSe
|
||||
|
||||
scanner := bufio.NewScanner(pr)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Bytes()
|
||||
if len(line) == 0 {
|
||||
continue
|
||||
}
|
||||
if err := stream.Send(&mcpv1.LogsResponse{
|
||||
Data: append(scanner.Bytes(), '\n'),
|
||||
Data: append(line, '\n'),
|
||||
}); err != nil {
|
||||
_ = cmd.Process.Kill()
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user