From eefa329f0e48d7fed40f67846b17ef783727fbdf Mon Sep 17 00:00:00 2001 From: Russtopia Date: Wed, 24 Jun 2020 11:53:17 -0700 Subject: [PATCH] Improve ssync error msgs --- cmd/coder/sync.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/coder/sync.go b/cmd/coder/sync.go index 9aa0a0ca..8bc1f9c7 100644 --- a/cmd/coder/sync.go +++ b/cmd/coder/sync.go @@ -2,6 +2,7 @@ package main import ( "errors" + "fmt" "os" "path/filepath" "strings" @@ -31,7 +32,8 @@ func (cmd *syncCmd) RegisterFlags(fl *pflag.FlagSet) { } // See https://lxadm.com/Rsync_exit_codes#List_of_standard_rsync_exit_codes. -var NoRsync = errors.New("rsync: exit status 2") +var IncompatRsync = errors.New("rsync: exit status 2") +var StreamErrRsync = errors.New("rsync: exit status 12") func (cmd *syncCmd) Run(fl *pflag.FlagSet) { var ( @@ -79,8 +81,10 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) { err = s.Run() } - if err == NoRsync { + if fmt.Sprintf("%v", err) == fmt.Sprintf("%v", IncompatRsync) { flog.Fatal("no compatible rsync present on remote machine") + } else if fmt.Sprintf("%v", err) == fmt.Sprintf("%v", StreamErrRsync) { + flog.Fatal("error in rsync protocol datastream (no installed remote rsync?)") } else { flog.Fatal("sync: %v", err) }