feat(controller): added copy by server only currently

This commit is contained in:
2025-09-06 17:01:49 -05:00
parent 750e6948b6
commit 71dcbf814b
7 changed files with 445 additions and 141 deletions

View File

@@ -0,0 +1,21 @@
package main
import (
"bufio"
"fmt"
"io"
socketio "github.com/googollee/go-socket.io"
)
// streamOutput reads io.Reader line by line and broadcasts
func streamOutput(r io.Reader, server *socketio.Server, room string) {
scanner := bufio.NewScanner(r)
for scanner.Scan() {
line := scanner.Text()
server.BroadcastToRoom("/", room, "buildlogs", line)
}
if err := scanner.Err(); err != nil {
server.BroadcastToRoom("/", room, "buildlogs", fmt.Sprintf("❌ Log stream error: %v", err))
}
}