mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
Fix variable binding bug when saving logs
This commit is contained in:
parent
9a764b764b
commit
ffb96e5a6d
@ -76,7 +76,7 @@ func logCore(cmds []command, hosts []string, dir, provider string) {
|
||||
fmt.Printf("SSH'ing to all nodes and running %s\n", cmd.cmd)
|
||||
for _, host := range hosts {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
go func(cmd command, host string) {
|
||||
defer wg.Done()
|
||||
logfile := fmt.Sprintf("%s/%s-%s.log", dir, host, cmd.component)
|
||||
fmt.Printf("Writing to %s.\n", logfile)
|
||||
@ -87,7 +87,7 @@ func logCore(cmds []command, hosts []string, dir, provider string) {
|
||||
if err := ioutil.WriteFile(logfile, []byte(stdout+stderr), 0777); err != nil {
|
||||
fmt.Printf("Error writing logfile: %v\n", err)
|
||||
}
|
||||
}()
|
||||
}(cmd, host)
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
|
Loading…
Reference in New Issue
Block a user