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

Verify rsync protocol version match prior to proceeding - Rebased on current master. #71

Merged
merged 7 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Return error directly in internal/sync/sync.go#Version
  • Loading branch information
stephenwithav committed Jul 2, 2020
commit d853066ae320cf5fbd04d5896e8f9aaf3a249265
2 changes: 1 addition & 1 deletion cmd/coder/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
if rsyncErr != nil {
flog.Info("Unable to determine remote rsync version. Proceeding cautiously.")
} else if localVersion != remoteVersion {
flog.Fatal(fmt.Sprintf("rsync protocol mismatch. local is %s; remote is %s.", localVersion, remoteVersion))
flog.Fatal(fmt.Sprintf("rsync protocol mismatch. %s.", localVersion, rsyncErr))
}

for err == nil || err == sync.ErrRestartSync {
Expand Down
6 changes: 3 additions & 3 deletions internal/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ func (s Sync) Version() (string, error) {
io.Copy(buf, process.Stdout())

err = process.Wait()
if code, ok := err.(wsep.ExitError); ok {
return "", fmt.Errorf("Version check exit status: %v", code)
if _, ok := err.(wsep.ExitError); ok {
return "", err
}
if err != nil {
return "", fmt.Errorf("Server version mismatch")
return "", err
}

firstLine, err := buf.ReadString('\n')
Expand Down