Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit eefa329

Browse files
author
Russtopia
committed
Improve ssync error msgs
1 parent c69c791 commit eefa329

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmd/coder/sync.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"errors"
5+
"fmt"
56
"os"
67
"path/filepath"
78
"strings"
@@ -31,7 +32,8 @@ func (cmd *syncCmd) RegisterFlags(fl *pflag.FlagSet) {
3132
}
3233

3334
// See https://lxadm.com/Rsync_exit_codes#List_of_standard_rsync_exit_codes.
34-
var NoRsync = errors.New("rsync: exit status 2")
35+
var IncompatRsync = errors.New("rsync: exit status 2")
36+
var StreamErrRsync = errors.New("rsync: exit status 12")
3537

3638
func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
3739
var (
@@ -79,8 +81,10 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
7981
err = s.Run()
8082
}
8183

82-
if err == NoRsync {
84+
if fmt.Sprintf("%v", err) == fmt.Sprintf("%v", IncompatRsync) {
8385
flog.Fatal("no compatible rsync present on remote machine")
86+
} else if fmt.Sprintf("%v", err) == fmt.Sprintf("%v", StreamErrRsync) {
87+
flog.Fatal("error in rsync protocol datastream (no installed remote rsync?)")
8488
} else {
8589
flog.Fatal("sync: %v", err)
8690
}

0 commit comments

Comments
 (0)