Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Rsync error msgs#58

Merged
Russtopia merged 1 commit intomasterfromrsync-error-msgs
Jun 24, 2020
Merged
Changes fromall commits
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
8 changes: 6 additions & 2 deletionscmd/coder/sync.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ package main

import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"
Expand DownExpand 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 DownExpand Up@@ -79,8 +81,10 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
err = s.Run()
}

if err ==NoRsync {
iffmt.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?)")
Comment on lines +84 to +87
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This isn't great.

We should be checking the exit codehere, and wrap the error with an informative string based on the exit code.

Seehttps://stackoverflow.com/a/55055100 for how we can get the exit code from a command error.

Copy link
Author

@RusstopiaRusstopiaJun 25, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, I figured this wasn't be best way to do it :/ I'll update this ASAP, and include it in PR#60

} else {
flog.Fatal("sync: %v", err)
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp