Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit afc57e9

Browse files
committedApr 20, 2019
Pass ssh flags to rsync
Resolves #19
1 parent 3f4919f commit afc57e9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ chmod +x `+codeServerPath+`
8484
flog.Info("synced settings in %s", time.Since(start))
8585

8686
flog.Info("syncing extensions")
87-
err = syncExtensions(host)
87+
err = syncExtensions(host, *sshFlags)
8888
if err != nil {
8989
flog.Fatal("failed to sync extensions: %v", err)
9090
}
@@ -208,24 +208,24 @@ func syncUserSettings(host string) error {
208208
return rsync(localConfDir+"/", remoteSettingsDir, host, "workspaceStorage", "logs", "CachedData")
209209
}
210210

211-
func syncExtensions(host string) error {
211+
func syncExtensions(host string, sshFlags string) error {
212212
localExtensionsDir, err := extensionsDir()
213213
if err != nil {
214214
return err
215215
}
216216
const remoteExtensionsDir = ".local/share/code-server/extensions"
217217

218-
return rsync(localExtensionsDir+"/", remoteExtensionsDir, host)
218+
return rsync(localExtensionsDir+"/", remoteExtensionsDir, sshFlags, host)
219219
}
220220

221-
func rsync(src string, dest string, host string, excludePaths ...string) error {
221+
func rsync(src string, dest string, host string, sshFlags string, excludePaths ...string) error {
222222
remoteDest := fmt.Sprintf("%s:%s", host, dest)
223223
excludeFlags := make([]string, len(excludePaths))
224224
for i, path := range excludePaths {
225225
excludeFlags[i] = "--exclude=" + path
226226
}
227227

228-
cmd := exec.Command("rsync", append(excludeFlags, "-azv", "--copy-unsafe-links", src, remoteDest)...)
228+
cmd := exec.Command("rsync", append(excludeFlags, "-e", "ssh "+sshFlags, "-azv", "--copy-unsafe-links", src, remoteDest)...)
229229
cmd.Stdout = os.Stdout
230230
cmd.Stderr = os.Stderr
231231
err := cmd.Run()

0 commit comments

Comments
 (0)
This repository has been archived.