@@ -19,6 +19,8 @@ import (
19
19
"golang.org/x/xerrors"
20
20
)
21
21
22
+ const codeServerPath = "~/.cache/sshcode/sshcode-server"
23
+
22
24
type options struct {
23
25
skipSync bool
24
26
syncBack bool
@@ -30,8 +32,6 @@ type options struct {
30
32
func sshCode (host , dir string , o options ) error {
31
33
flog .Info ("ensuring code-server is updated..." )
32
34
33
- const codeServerPath = "/tmp/sshcode-code-server"
34
-
35
35
dlScript := downloadScript (codeServerPath )
36
36
37
37
// Downloads the latest code-server and allows it to be executed.
@@ -97,7 +97,7 @@ func sshCode(host, dir string, o options) error {
97
97
sshCmd .Stderr = os .Stderr
98
98
err = sshCmd .Start ()
99
99
if err != nil {
100
- flog . Fatal ("failed to start code-server: %v " , err )
100
+ return xerrors . Errorf ("failed to start code-server: %w " , err )
101
101
}
102
102
103
103
url := "http://127.0.0.1:" + o .localPort
@@ -313,12 +313,13 @@ func downloadScript(codeServerPath string) string {
313
313
return fmt .Sprintf (
314
314
`set -euxo pipefail || exit 1
315
315
316
- mkdir -p ~/.local/share/code-server
316
+ mkdir -p ~/.local/share/code-server %v
317
317
cd %v
318
318
wget -N https://codesrv-ci.cdr.sh/latest-linux
319
319
[ -f %v ] && rm %v
320
320
ln latest-linux %v
321
321
chmod +x %v` ,
322
+ filepath .Dir (codeServerPath ),
322
323
filepath .Dir (codeServerPath ),
323
324
codeServerPath ,
324
325
codeServerPath ,
0 commit comments