(p []byte)
| 1410 | } |
| 1411 | |
| 1412 | func (w *logWriter) Write(p []byte) (int, error) { |
| 1413 | w.mu.Lock() |
| 1414 | defer w.mu.Unlock() |
| 1415 | |
| 1416 | w.buf = append(w.buf, p...) |
| 1417 | for { |
| 1418 | idx := bytes.IndexByte(w.buf, '\n') |
| 1419 | if idx < 0 { |
| 1420 | break |
| 1421 | } |
| 1422 | line := string(w.buf[:idx]) |
| 1423 | w.buf = w.buf[idx+1:] |
| 1424 | if line != "" { |
| 1425 | w.logger.Info(context.Background(), line) |
| 1426 | } |
| 1427 | } |
| 1428 | return len(p), nil |
| 1429 | } |
| 1430 | |
| 1431 | func isPortBusy(ctx context.Context, port int64) bool { |
| 1432 | d := net.Dialer{Timeout: 2 * time.Second} |