Skip to content

Commit

Permalink
cluster: fix stdout and stderr (#1763)
Browse files Browse the repository at this point in the history
  • Loading branch information
tongtongyin authored Feb 22, 2022
1 parent dc4f2d3 commit 9681e46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cluster/ctxt/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ func (ctx *Context) SetExecutor(host string, e Executor) {
// GetOutputs get the outputs of a host (if has any)
func (ctx *Context) GetOutputs(hostID string) ([]byte, []byte, bool) {
ctx.mutex.RLock()
stdout, ok1 := ctx.exec.stderrs[hostID]
stderr, ok2 := ctx.exec.stdouts[hostID]
stdout, ok1 := ctx.exec.stdouts[hostID]
stderr, ok2 := ctx.exec.stderrs[hostID]
ctx.mutex.RUnlock()
return stdout, stderr, ok1 && ok2
}

// SetOutputs set the outputs of a host
func (ctx *Context) SetOutputs(hostID string, stdout []byte, stderr []byte) {
ctx.mutex.Lock()
ctx.exec.stderrs[hostID] = stdout
ctx.exec.stdouts[hostID] = stderr
ctx.exec.stdouts[hostID] = stdout
ctx.exec.stderrs[hostID] = stderr
ctx.mutex.Unlock()
}

Expand Down

0 comments on commit 9681e46

Please sign in to comment.