MCPcopy Create free account
hub / github.com/sql-machine-learning/sqlflow / Write

Method Write

go/executor/executor.go:127–150  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

125}
126
127func (cw *logChanWriter) Write(p []byte) (n int, err error) {
128 // Both cmd.Stdout and cmd.Stderr are writing to cw
129 cw.m.Lock()
130 defer cw.m.Unlock()
131
132 n, err = cw.buf.Write(p)
133 if err != nil {
134 return n, err
135 }
136 for {
137 line, err := cw.buf.ReadString('\n')
138 cw.prev = cw.prev + line
139 // ReadString returns err != nil if and only if the returned Data
140 // does not end in delim.
141 if err != nil {
142 break
143 }
144 if err := cw.wr.Write(cw.prev); err != nil {
145 return len(cw.prev), err
146 }
147 cw.prev = ""
148 }
149 return n, nil
150}
151
152func (cw *logChanWriter) Close() {
153 if len(cw.prev) > 0 {

Callers 10

TestLogChanWriter_WriteFunction · 0.95
runQueryFunction · 0.45
parseRowFunction · 0.45
runExecFunction · 0.45
CloseMethod · 0.45
ExecuteExplainMethod · 0.45
ExecuteShowTrainMethod · 0.45
createPAIHyperParamFileFunction · 0.45
ExecuteExplainMethod · 0.45
ExecuteExplainMethod · 0.45

Calls

no outgoing calls

Tested by 1

TestLogChanWriter_WriteFunction · 0.76