Skip to content

Commit

Permalink
cmd/sync: prints the executed command parameters and the result of th…
Browse files Browse the repository at this point in the history
…e command (#5127)
  • Loading branch information
zhijian-pro authored Sep 2, 2024
1 parent 3528ee7 commit 44eebbc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/sync/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,13 @@ func launchWorker(address string, config *Config, wg *sync.WaitGroup) {
}
rpath := filepath.Join("/tmp", filepath.Base(path))
cmd := exec.Command("rsync", "-au", path, host+":"+rpath)
err = cmd.Run()
output, err := cmd.CombinedOutput()
logger.Debugf("exec: %s,err: %s", cmd.String(), string(output))
if err != nil {
// fallback to scp
cmd = exec.Command("scp", path, host+":"+rpath)
err = cmd.Run()
output, err = cmd.CombinedOutput()
logger.Debugf("exec: %s,err: %s", cmd.String(), string(output))
}
if err != nil {
logger.Errorf("copy itself to %s: %s", host, err)
Expand Down

0 comments on commit 44eebbc

Please sign in to comment.