Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Commit 198dda8

Browse files
committed
fixup! Add flag to sync extensions back to local
1 parent f3ae9cd commit 198dda8

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

main.go

+17-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ More info: https://github.com/codercom/sshcode
6464
"-tt",
6565
host,
6666
`/bin/bash -c 'set -euxo pipefail || exit 1
67+
# Make sure any currently running code-server is gone so we can overwrite
68+
# the binary.
69+
pkill -9 `+filepath.Base(codeServerPath)+` || true
6770
wget -q https://codesrv-ci.cdr.sh/latest-linux -O `+codeServerPath+`
6871
mkdir -p ~/.local/share/code-server
6972
cd `+filepath.Dir(codeServerPath)+`
@@ -138,16 +141,18 @@ chmod +x `+codeServerPath+`
138141
}
139142

140143
ctx, cancel = context.WithCancel(context.Background())
144+
openBrowser(url)
145+
141146
go func() {
142147
defer cancel()
143-
openBrowser(url)
144148
sshCmd.Wait()
145149
}()
146150

147151
c := make(chan os.Signal)
148152
signal.Notify(c, os.Interrupt)
149153

150154
var shutdownWg sync.WaitGroup
155+
151156
shutdownWg.Add(1)
152157
go func() {
153158
defer shutdownWg.Done()
@@ -284,7 +289,17 @@ func rsync(src string, dest string, excludePaths ...string) error {
284289
excludeFlags[i] = "--exclude=" + path
285290
}
286291

287-
cmd := exec.Command("rsync", append(excludeFlags, "-azv", "--copy-unsafe-links", src, dest)...)
292+
cmd := exec.Command("rsync", append(excludeFlags, "-az",
293+
"--progress",
294+
"--stats",
295+
// Without --size-only, synchronizing back always results in a
296+
// full copy. For some reason, rsync with --times doesn't actually
297+
// change modification times on the destination.
298+
"--size-only",
299+
"--copy-unsafe-links",
300+
src, dest,
301+
)...,
302+
)
288303
cmd.Stdout = os.Stdout
289304
cmd.Stderr = os.Stderr
290305
err := cmd.Run()

0 commit comments

Comments
 (0)