TranslateRsyncErrorCode translates the exit code of rsync to a message
(cmdErr error)
| 144 | |
| 145 | // TranslateRsyncErrorCode translates the exit code of rsync to a message |
| 146 | func TranslateRsyncErrorCode(cmdErr error) (exitCode int, msg string) { |
| 147 | |
| 148 | if exiterr, ok := cmdErr.(*exec.ExitError); ok { |
| 149 | exitCode = exiterr.ExitCode() |
| 150 | strerr, valid := rsyncExitValues[exitCode] |
| 151 | if valid { |
| 152 | msg = fmt.Sprintf("rsync error: %s", strerr) |
| 153 | } |
| 154 | } |
| 155 | return |
| 156 | } |