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

Devurl crud ops #60

Merged
merged 5 commits into from
Jun 29, 2020
Merged
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
Improve ssync error msgs
  • Loading branch information
Russtopia committed Jun 24, 2020
commit eefa329f0e48d7fed40f67846b17ef783727fbdf
8 changes: 6 additions & 2 deletions cmd/coder/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
}
Expand Down