mux fix
This commit is contained in:
parent
c477cfabc6
commit
a683b6b1ac
|
@ -8,6 +8,8 @@ import (
|
|||
)
|
||||
|
||||
func (m *Manager) ExecuteEverywhere(cmd string) {
|
||||
m.clientsMUX.Lock()
|
||||
defer m.clientsMUX.Unlock()
|
||||
for host, client := range m.clients {
|
||||
m.execute(host, client, cmd)
|
||||
}
|
||||
|
|
|
@ -24,9 +24,13 @@ func SSHResultToStringHandler(handler SSHResultHandler) SSHResultHandler {
|
|||
}
|
||||
|
||||
func (m *Manager) RunEverywhere(cmd string, handler SSHResultHandler) {
|
||||
m.clientsMUX.Lock()
|
||||
defer m.clientsMUX.Unlock()
|
||||
for host, client := range m.clients {
|
||||
go func() {
|
||||
result, err := m.run(host, client, cmd)
|
||||
handler(host, result, err)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue