Significant improvements to attaching/console handling

This commit is contained in:
Dane Everitt
2019-04-20 16:20:08 -07:00
parent ebe98aa860
commit 870adffc14
6 changed files with 181 additions and 23 deletions

21
server/console.go Normal file
View File

@@ -0,0 +1,21 @@
package server
import "io"
type Console struct {
Server *Server
HandlerFunc *func(string)
}
var _ io.Writer = Console{}
func (c Console) Write(b []byte) (int, error) {
if c.HandlerFunc != nil {
l := make([]byte, len(b))
copy(l, b)
(*c.HandlerFunc)(string(l))
}
return len(b), nil
}