This commit is contained in:
Martin Geno 2017-07-08 19:00:36 +02:00
parent c477cfabc6
commit a683b6b1ac
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
2 changed files with 8 additions and 2 deletions

View File

@ -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)
}

View File

@ -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)
}()
}
}