This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree 2 files changed +15
-5
lines changed
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,12 @@ func (s *syncCmd) version() string {
55
55
log .Fatal (err )
56
56
}
57
57
58
- versionString := strings .Split (r .ReadLine (), "protocol version " )
58
+ firstLine , err := r .ReadString ('\n' )
59
+ if err != nil {
60
+ return ""
61
+ }
62
+
63
+ versionString := strings .Split (firstLine , "protocol version " )
59
64
60
65
return versionString [1 ]
61
66
}
@@ -103,8 +108,8 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
103
108
Client : entClient ,
104
109
}
105
110
106
- localVersion := s .version ()
107
- remoteVersion , rsyncErr := sync .Version ()
111
+ localVersion := cmd .version ()
112
+ remoteVersion , rsyncErr := s .Version ()
108
113
109
114
if rsyncErr != nil {
110
115
flog .Info ("Unable to determine remote rsync version. Proceeding cautiously." )
Original file line number Diff line number Diff line change @@ -287,13 +287,18 @@ func (s Sync) Version() (string, error) {
287
287
288
288
err = process .Wait ()
289
289
if code , ok := err .(wsep.ExitError ); ok {
290
- return "" , err
290
+ return "" , fmt .Errorf ("Version heck exit status: %v" , code )
291
+ }
292
+ if err != nil {
293
+ return "" , fmt .Errorf ("Server version mismatch" )
291
294
}
295
+
296
+ firstLine , err := r .ReadString ('\n' )
292
297
if err != nil {
293
298
return "" , err
294
299
}
295
300
296
- versionString := strings .Split (r . ReadLine () , "protocol version " )
301
+ versionString := strings .Split (firstLine , "protocol version " )
297
302
298
303
return versionString [1 ], nil
299
304
}
You can’t perform that action at this time.
0 commit comments